home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
vpi1manl.zip
/
PART2.MAN
< prev
next >
Wrap
Text File
|
1991-12-29
|
205KB
|
6,608 lines
VP-Info Level 1 Reference Manual Page 109 SECTION 3
STR(
Converts a number to a string.
╔════════════════════════════════════════════════════════════════════╗
║ STR(<num exp>,<width num exp>[,<decimals num exp>]) ║
║ ║
║ <num exp> the number to be converted ║
║ <width num exp> the width of the string ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ <decimals num exp> the number of decimals ║
╟─────────────────┐ ║
║ Type: character │ ║
╚═════════════════╧══════════════════════════════════════════════════╝
This function gets a number by evaluating the <num exp>, and
converts it into a string of given width. Optionally, the number of
decimals can be specified (the default is 0). See also PIC(.
Examples:
1>x=123.456
1>? STR(x,8)
123
1>? LEN(STR(x,8))
8.00
1>? STR(x,10)
123
1>? STR(x,10,1)
123.1
When combined with the VAL( function, STR( is a convenient way of
rounding decimal numbers with a given precision. For example:
1>:PICTURE='9999.99999'
1>a=29.95748
1>? a
29.95748
1>? VAL(STR(a+.005,10,2))
29.96000
1>? VAL(STR(a+.00005,10,4))
29.95750
STR( VPI1 VPI VPIN STR(
VP-Info Level 1 Reference Manual Page 110 SECTION 3
SUBSTR(
Gets a substring of a string.
╔════════════════════════════════════════════════════════════════════╗
║ SUBSTR(<str exp>, <start num exp>, <width num exp>) ║
║ ║
║ <str exp> the string from which the new string is formed ║
║ <start num exp> the position from which the new string is ║
║ taken ║
║ <width num exp> the number of characters to place in the ║
║ new string ║
╟─────────────────┐ ║
║ Type: character │ ║
╚═════════════════╧══════════════════════════════════════════════════╝
This function, a synonym for the $( function, takes the string in
<str exp> from position <start num exp> (fractions are thrown away);
the number of characters taken is <width num exp>. (In both numeric
expressions, the fractions are disregarded).
Examples:
1>name='David Barberr'
1>? SUBSTR(name, 7,3)
Bar
1>? SUBSTR(name, 7,12)
Barberr
1>? LEN(SUBSTR(name,7,12))
7.00
Note that SUBSTR(name,7,12) is of width 7, not 12; there are only
7 letters left in name from position 7.
1>s=3
1>t=1
1>? SUBSTR(name+name,(s+t)/2,1.9)
a
Note that 1.9 was taken as 1.
SUBSTR( VPI1 VPI VPIN SUBSTR(
VP-Info Level 1 Reference Manual Page 111 SECTION 3
TEST(
Tests a string whether it is a valid expression.
╔════════════════════════════════════════════════════════════════════╗
║ TEST(<str exp>) ║
║ ║
║ <str exp> the string to be tested ║
╟───────────────┐ ║
║ Type: logical │ ║
╚═══════════════╧════════════════════════════════════════════════════╝
This function tests the string in <str exp> as to whether it is a
valid expression; in particular, all variables must be defined and
must be of the proper type. It returns T if it is, F otherwise. If
the test is successful, TYPE( can be used to find the type of the
expression.
In a VP-Info Level 1 program, use TEST( to find out whether a
selection criteria typed in by the user is correct. Or use it to
ensure that a variable exists in a subroutine that may be called from
several programs.
Examples:
1>? TEST('check=0')
F false because check is not defined
1>check=0
1>? TEST('check=0')
T
1>? TEST('check=0.or.check=1')
T
1>? TEST('check="A".or.check=1')
F false because "A" is of character
type
1>? TEST('num')
F
1>num=5
1>? TEST('num')
T
1>? TEST('num+') false because the second operand
is missing
F
IF .NOT. TEST('check')
check=0
ENDIF
TEST( VPI1 VPI VPIN TEST(
VP-Info Level 1 Reference Manual Page 112 SECTION 3
TIME(
Gets the system time.
╔════════════════════════════════════════════════════════════════════╗
║ TIME([<type>]) ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ <type> one of three types of information requested, as listed ║
║ below ║
╟─────────────────┐ ║
║ Type: character │ ║
╚═════════════════╧══════════════════════════════════════════════════╝
This function returns a string containing the current system
time, and changes the format of the system variable :TIME to this
format. (See the system variable :TIME in Section 2. Recall that
:TIME is initialized when VP-Info Level 1 starts up, but can be
reinitialized with a :TIME= command.)
The <type> can be given in either of two forms, a name or number
(numeric expression) as follows:
Type Explanation Example
1 or HMS Hours,minutes,seconds,hundredths 17:26:36.07
2 or AMPM Hours,minutes with AM/PM 5:36 pm
3 or Seconds Seconds since midnight 62804.80
Shortcut: When specifying type by name, only the first character
is required.
The default parameter is 1, the time in the 24-hour format
hh:mm:ss.hh.
Examples:
1>? :TIME
15:45:59
1>? TIME(2)
3:46 pm
1>:TIME
3:46 pm
start=VAL(TIME(seconds))
<program lines>
finish=VAL(TIME(seconds))
? 'Program execution took',start-finish,'seconds.'
TIME( VPI1 VPI VPIN TIME(
VP-Info Level 1 Reference Manual Page 113 SECTION 3
This displays how long the running of <program lines> took, in
seconds.
TIME( VPI1 VPI VPIN TIME(
VP-Info Level 1 Reference Manual Page 114 SECTION 3
TRIM(
Trims blanks from the right-hand side of a string.
╔════════════════════════════════════════════════════════════════════╗
║ TRIM(<str exp>) ║
║ ║
║ <str exp> the string to be trimmed ║
╟─────────────────┐ ║
║ Type: character │ ║
╚═════════════════╧══════════════════════════════════════════════════╝
VP-Info Level 1 stores strings in fields padded on the right with
blanks. In actual use, these blanks may get in the way. TRIM( gets
rid of the blanks on the right of a string. TRIM( can be used in the
key of an index. See also LTRIM(.
Examples:
1>a='David '
1>? a
David
1>? LEN(a)
10.00
1>? TRIM(a)+' is trimmed'
David is trimmed
1>? LEN(TRIM(a))
5.00
1>blank=' '
1>? LEN(TRIM(blank))
1.00
Note: TRIM(blank) is a single blank.
TRIM( VPI1 VPI VPIN TRIM(
VP-Info Level 1 Reference Manual Page 115 SECTION 3
TYPE(
Gets the type of an expression.
╔════════════════════════════════════════════════════════════════════╗
║ TYPE(<exp>) ║
║ ║
║ <exp> any expression ║
╟─────────────────┐ ║
║ Type: character │ ║
╚═════════════════╧══════════════════════════════════════════════════╝
For an expression, <exp>, this function returns the type of the
expression as a one character string:
C for character
L for logical
N for numeric
U Undefined ;created by GLOBAL or VARIABLES command, but not
yet given a value or type
To test whether a string is a valid expression, use the TEST(
function.
Examples:
1>a='name'
1>? TYPE(a)
C
1>? TYPE(a+a)
C
1>n=12
1>? TYPE(a+n)
1. Invalid variable type found when executing an expression.
1>? TYPE(a<a)
L
1>? TYPE(a<a.OR.n<5)
L
1>TYPE(n+5/10)
N
TYPE( VPI1 VPI VPIN TYPE(
VP-Info Level 1 Reference Manual Page 116 SECTION 3
UPPER(
Converts a string to upper case.
╔════════════════════════════════════════════════════════════════════╗
║ UPPER(<str exp>) ║
║ ║
║ <str exp> the text to be converted to upper case ║
╟─────────────────┐ ║
║ Type: character │ ║
╚═════════════════╧══════════════════════════════════════════════════╝
All lower-case letters in the <str exp> are converted into upper
case by the UPPER( function, which is a synonym for the !( function.
See also the LOWER( function.
Examples:
1>a='Aa12b'
1>? UPPER(a)
AA12B
1>? UPPER('David!')
DAVID!
Note that only the lower-case letters are changed.
UPPER( VPI1 VPI VPIN UPPER(
VP-Info Level 1 Reference Manual Page 117 SECTION 3
VAL(
Converts a string to its numeric value.
╔════════════════════════════════════════════════════════════════════╗
║ VAL(<str exp>) ║
║ ║
║ <str exp> the string to be evaluated ║
╟───────────────┐ ║
║ Type: numeric │ ║
╚═══════════════╧════════════════════════════════════════════════════╝
This function takes the string <str exp> which is a number, and
returns it as a number. If the whole string cannot be interpreted as
a number, it takes as much of the front part as it can.
Examples:
1>a='123.23'
1>? VAL(a)
123.23
1>? VAL(123.23)
1. Invalid variable type found when executing an expression.
1>? VAL('a12')
0.00
1>? VAL('12a')
12.00
1>? VAL(DATE(2))
yields the current month as a number.
VAL( VPI1 VPI VPIN VAL(
VP-Info Level 1 Reference Manual Page 118 SECTION 3
WOPEN(
Opens a DOS file for writing.
╔════════════════════════════════════════════════════════════════════╗
║ WOPEN(<str exp>[,<filenum>]) ║
║ ║
║ <str exp> the file name ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ <filenum> the DOS file number (between 1 and 4) ║
╟───────────────┐ ║
║ Type: logical │ ║
╚═══════════════╧════════════════════════════════════════════════════╝
This function opens the DOS file, and in particular, the
sequential file <str exp> (or output device, such as COM1:) for
writing; if the file does not exist, it will be created. If filenum
is not given, filenum=1 is assumed. If no file extension is given,
the extension TXT is used. It returns T if successful, F otherwise.
See the functions ROPEN(, CLOSE(, GET(, PUT(, SEEK(, SSEEK(,
WRITE(, READ(, IN(, OUT(.
Example:
1>ok=WOPEN('a:label.prg')
1>? ok
T
In a VP-Info Level 1 program, WOPEN( normally appears in an IF
command:
IF WOPEN('file',2)
2. Two programs to print a text file, TEST (in the second version
it is assumed that TEST has no more than 20 lines):
SET WIDTH TO 80
SET PRINT ON
IF ROPEN('test')
DO WHILE READ(line)
? line
ENDDO
ok=CLOSE()
ENDIF
WOPEN( VPI1 VPI VPIN WOPEN(
VP-Info Level 1 Reference Manual Page 119 SECTION 3
WRAP(
Wraps text for output.
╔════════════════════════════════════════════════════════════════════╗
║ WRAP(<str var>, <num exp>) ║
║ ║
║ <str exp> the string to be wrapped ║
║ <num exp> the line width ║
╟─────────────────┐ ║
║ Type: character │ ║
╚═════════════════╧══════════════════════════════════════════════════╝
This function returns one line of text with word wrapping from
the string in <str var>; <str var> now contains what is left of the
string. In other words, the string returned will contain as many
words as will fit in a line (the line width is given by <num exp>).
If the whole contents of <str var> is one line, <str var> becomes the
blank string (of length 1)
WRAP(, IN(, GET(, and READ( are the only functions that change
the contents of the memory variable used as an argument.
Examples:
1>text='This text line is going to be wrapped in a printed line of
width 30.'
1>? text
This text line is going to be wrapped in a printed line of width 30.
1>temp=text
1>WRAP(temp,30)
This text line is going to be
1>? temp
wrapped in a printed line of width 30.
1>WRAP(temp,30)
wrapped in a printed line of
1>? temp
width 30.
1>WRAP(temp,30)
width 30.
1>? temp
1>? LEN(temp)
1.00
WRAP( VPI1 VPI VPIN WRAP(
VP-Info Level 1 Reference Manual Page 120 SECTION 3
WRITE(
Writes a new line into the sequential file.
╔════════════════════════════════════════════════════════════════════╗
║ WRITE(<str var>[,<filenum>]) ║
║ ║
║ <str var> the line to be written ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ <filenum> the DOS file number (between 1 and 4) ║
╟───────────────┐ ║
║ Type: logical │ ║
╚═══════════════╧════════════════════════════════════════════════════╝
This function writes (appends) the contents of the string
variable <str var> to the end of a sequential file opened with the
WOPEN( function.
If filenum is not given, filenum=1 is assumed. WRITE( returns T
if successful, F otherwise.
See the functions ROPEN(, WOPEN(, READ(, IN(, OUT(, GET(, PUT(,
and CLOSE(.
Example:
1>ok=WOPEN('customer.frm',2)
1>ok=WRITE('FIELDS - cust,orderno,amount',2)
1>ok=CLOSE(2)
creates the CUSTOMER.FRM report form file:
FIELDS - cust,orderno,amount
Now the command REPORT CUSTOMER will run the report. This
example illustrates how a program can be written that creates a report
form file.
In a VP-Info Level 1 program, WRITE( normally appears in an IF
command:
IF WRITE('file',2)
WRITE( VPI1 VPI VPIN WRITE(
VP-Info Level 1 Reference Manual Page 121 SECTION 3
3.5. Expressions
Expressions can be formed from constants (Section 3.1) and
variables (Section 2.3) using operations (Section 3.2), relations
(Section 3.3), and functions (Section 3.4). There are three types of
expressions: numeric, string, and logical.
Numeric expressions are built up from numeric constants, numeric
variables, and from functions that give results of numeric type; they
are formed with the operations: +, -, *, /, and the parentheses: (
and ).
String expressions are formed from string constants, string
variables, and from functions that give results of character type;
they use the operation + and the parentheses: ( and ).
Logical expressions (also called conditions) are formed from
logical constants, logical variables, functions that give results of
logical type, and the results of relations; they use the logical
operations: .AND., .OR., .NOT., and the parentheses: ( and ).
Examples: (in these examples, str1, str2 are string variables,
num1, num2 are numeric variables, log1, log2 are logical variables):
String expressions:
str1
str1+str2
str1+TRIM(str2)
str1+STR(num1+num2,10,2)+'Bach'
Numeric expressions:
num1
num1+5
(num1+5)/5
num1+(num2*VAL(str1))
LEN(str1)+LEN(TRIM(str2))+2
Conditions (logical expressions):
num1 < num2
num1+num2+LEN(str1) <> 15 .AND. .NOT. EOF
(str1='Boston') .AND. (num1 <> LEN(str1)).AND.log1.AND.(.NOT.log2)
Expressions VPI1 VPI VPIN Expressions
VP-Info Level 1 Reference Manual Page 122 SECTION 3
3.6. Rules of Precedence
In an expression such as
2+3*4
VP-Info Level 1 has to decide whether to perform the + first (result:
20) or the * first (result: 23). The Rules of Precedence decide such
questions.
Functions have the highest precedence.
Arithmetic operations have the second highest precedence; among
themselves:
*, /
then
+, -
Relations are next; among themselves they all have the same
precedence.
Logical operations come last; among themselves:
.NOT.
then
.AND., .OR.
When two or more of the above have the same precedence, they are
performed from left to right.
The parentheses: ( and ) have higher precedence than functions,
operations, or relations. Thus you can set the precedence explicitly
using parentheses.
This means that you do not have to get involved in familiarizing
yourself with the Rules of Precedence. If you want + first, write
(2+3)*4
If you want * first, write:
2+(3*4)
Expressions VPI1 VPI VPIN Expressions
VP-Info Level 1 Reference Manual Page 123 SECTION 3
The parentheses tell VP-Info Level 1 how you want the operations
performed! Since VP-Info Level 1 throws away the parentheses when the
expression is compiled, you gain readability by using parentheses and
loose nothing.
Expressions VPI1 VPI VPIN Expressions
VP-Info Level 1 Reference Manual Page 124 SECTION 4
SECTION 4. VP-Info Level 1 COMMANDS
All Level 1 and VP-Info Professional commands are defined in this
section. Wherever differences exist between the two versions, they
are noted. All comments applicable to Level 1 also apply to VP-Info
Professional and VP-Info Professional II. All references to VP-Info
Professional apply equally to the corresponding version of VP-Info
Professional II.
First, the form of the commands and the symbols used in defining
them are discussed. The sample files used are described in the
Appendix.
Then all the commands are listed alphabetically.
4.1. The Form of the Commands
A VP-Info Level 1 command consists of a command verb, such as
LIST, REPLACE; this is mostly followed by clauses that describe in
more detail what is to be done; for instance, in
LIST NEXT 10
the clause: "NEXT 10" restricts the LIST to the next 10 records
beginning with the current record. In
REPLACE amount WITH price*qty
the clause "amount WITH price*qty" means that the field AMOUNT is to
be replaced with the expression "price*qty". The command
LIST NEXT 10 FOR amount<1000
has two clauses.
The command verb is always the first one or two words; in the
command listing, the command verb is shown as the heading. For
instance, APPEND FROM is a command verb; so is COPY (and also COPY
STRUCTURE). In the command:
name='DAVID'
Form of the Commands Form of the Commands
VP-Info Level 1 Reference Manual Page 125 SECTION 4
= is the command verb; this is the only exception to the rule that the
first word of a command line is always the command verb.
The clauses are put together from VP-Info Level 1 keywords, such
as WITH, FOR, NEXT, and from variables. As a rule, in this manual,
keywords will be shown in capital letters; however, the user can type
them with upper- or lower-case letters. All VP-Info Level 1 keywords
are listed in Appendix ???.
The power of VP-Info Level 1 derives from the fact that each
command can be made more selective with these clauses. Two of the
most powerful clauses are scope (such as NEXT <n> and WHILE <cond>)
and selection (FOR <cond>).
4.2. Symbols
In Section 4.3, all commands will be described in detail. The
following symbols are used to describe the form of a command:
[ ] clauses in square brackets are optional. Do not type the
brackets! (The only exception is the DIM command and
matrix names that use [ and ].)
Example:
APPEND [OFF]
APPEND is a command and so is APPEND OFF. There may be
many optional clauses in a command.
/ clauses connected with / indicate an option or a switch; you
can choose the clause before or after the /, but not
both (the switch can also be optional).
Examples:
SET EXACT ON/OFF
SET EXACT ON and SET EXACT OFF are valid commands.
APPEND FROM <file> [FOR <cond>] [SDF/SDF DELIMITED]
SDF and SDF DELIMITED are optional clauses; you can
choose neither, or either one, but not both.
< > Pointed brackets indicate that the user has to type in some
information, for instance, <file> indicates that a file
Symbols Symbols
VP-Info Level 1 Reference Manual Page 126 SECTION 4
name has to be typed in. Never type the pointed
brackets. Here are the most common information
requests:
<cond> condition (logical expression), see <exp>.
Examples:
name='David'
!(name)='DAVID'
num3 < (num1+5) * 2.71
<const> constant (see Section 3.1).
Examples:
Numeric constant: 3.5
String constant: 'bread'
Logical constant: T or F.
If the constant has to be one of these specified types,
instead of <const>, you find <num const>, <str const>,
<log const>.
<exp> expression (see Section 3.5).
Examples:
Numeric expression: num1+3 (NUM1 is a numeric variable)
String expression: name+$(fname,1,5) (NAME and FNAME
are string variables, $( is a string function)
Logical expression (or condition): (2 < num1) .OR. male
(NUM1 is a numeric variable, MALE is a logical
variable)
If the expression has to be one of these specified
types, instead of <exp>, you find <num exp>, <str exp>,
<cond>. (Note that a logical expression is the same as
a condition, see Section 3.5.)
<exp list> expression list; separate the expressions by commas. An
expression is an expression list with one item on the
list, so an <exp> will do wherever <exp list> is
requested.
Examples:
name
name,fname,tel:no,price*qty
Symbols Symbols
VP-Info Level 1 Reference Manual Page 127 SECTION 4
<field> field name.
<field list> field list; a list of fields separated by commas. A
field is a field list with one item on the list, so a
<field> will do wherever <field list> is requested.
Examples:
name
name,fname,tel_no
<file> file name.
Examples:
trans,data3
See Section 2 on VP-Info Level 1 files. The general
rule is that the extension, if not typed, is supplied by
VP-Info Level 1. For instance, if <file> asks for the
name of a data file, type TRANS, and VP-Info Level 1
supplies ".DBF".
<file list> file list; separate the files by commas.
Examples:
trans
trans,cust3,telno
<file number> file number, a number between 1 and 10 for VP-Info
Professional, between 1 and 6 for Level 1). See the
SELECT command on how a file number is selected.
<format> format string. See the @ command for the definition of
format strings.
Examples:
'99,999.99'
'XXA!XXA'
<line,col> line number and column number; both line and col are
numeric expressions.
Examples:
15,23
mrow+1,mcol+10
Symbols Symbols
VP-Info Level 1 Reference Manual Page 128 SECTION 4
<memvar> memory variable; see Section 2.3.
<memvar list> a list of memory variables separated by commas.
Example:
name,fname,salary,tel:no
<num const> numeric constant
Example:
5
<num exp> numeric expression, see <exp>.
Examples:
(num1+5)/5
VAL('3.14')+INT(field2)
<procedure> procedure name. See the PROCEDURE and PERFORM commands.
<program> program name.
Example:
invoice
<program segment> a number of VP-Info Level 1 commands.
Example:
price=23
amount=price * qty
@ 20,2 SAY amount
<scope> the scope of the command. There are four scopes:
ALL execute for all records
NEXT n execute for the next n records
RECORD n execute only for this record
WHILE <cond> execute while <cond> holds; should be
used only if <cond> holds for the
current record; this scope is very
useful for large data files
The scope is always optional; however, if none is
specified, the command will use the default scope. For
each command that can have a scope, the default scope is
given.
Symbols Symbols
VP-Info Level 1 Reference Manual Page 129 SECTION 4
<string> any type of string; a line of text.
Examples:
This is a string
12.89!
'<string>' A string in quotation marks (' or ", but matching)
Examples:
'This is a string'
"This is a string"
'1234'
"Alice's Restaurant"
<str const> string expression, see <const>.
Example:
'Number: '
<str exp> string expression, see <exp>.
Examples:
'Number: '+'34.89'
TRIM(str1)+$(field3,3,2)
<text> any number of lines of text.
Example:
This is a sample text for the TEXT command. Notice that
you do not have to press <ENTER> at the end of the line,
the words jump to the next line where necessary. You
press <ENTER> only at the end of a paragraph.
This is a new paragraph.
<var> variable name; see Section 2.3 for variables (same as
<memvar> or <field>).
Examples:
name
num1
Symbols Symbols
VP-Info Level 1 Reference Manual Page 130 SECTION 4
4.3. Command List
This section gives a complete listing of all the commands. For
more examples of the use of these commands, the reader is referred to
the original VP-Info Manual published by Paperback Software
International and distributed by Sub Rosa Publishing Inc. (Note that
the original VP-Info Manual describes the language as it was released
in 1986; all commands and functions of that release are still
supported, although many are substantially enhanced. The descriptive
material is generally accurate and applies equally to all versions of
VP-Info Level 1 except that networking is supported only by VP-Info
Professional Network Edition.)
As explained in Section 2.2, all commands that refer to data
files can be modified with a #n; for instance,
LIST#3 NEXT 4 FOR cost < 500
modifies the LIST command to use file 3. To avoid cluttering up the
description of the commands, this [#n] option is not given.
Normally, the explanation of the command is in five parts.
First, the command verb is displayed. Second, a brief explanation of
the command is given. The third part is the syntax, that is, the form
of the command, with an explanation of what each symbol stands for.
This part is framed for easy recognition. The next part is a detailed
explanation of how the command works. This is followed, as a rule, by
examples.
The HELP command brings to the screen the first three parts and
some examples when you use the standard help file; when you use the
long help file, the entire text given here is displayed on the screen.
In the examples, the data files of Appendix ??? will be used
without any reference.
Command List Command List
VP-Info Level 1 Reference Manual Page 131 SECTION 4
*
Place comments -- notes -- in programs.
╔════════════════════════════════════════════════════════════════════╗
║ * [<string>] ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ <string> any text line: the comment ║
╚════════════════════════════════════════════════════════════════════╝
The command * (or NOTE) is used for placing comments in a
program. VP-Info Level 1 ignores any line that starts with * (or
NOTE). Since the compilation removes all the comment lines, the
number of comments has no effect on the speed of the compiled program.
Notes can also be added with semicolon(;) at the end of any
VP-Info Level 1 command line.
Example:
In a program:
********************************************************************
* This is the start of the payroll computation module
* Programmer: David Simco
* Date: 2/8/90
********************************************************************
USE employee INDEX employee ;opening EMPLOYEE ordered by name
* VPI1 VPI VPIN *
VP-Info Level 1 Reference Manual Page 132 SECTION 4
=
Assign value to a memory variable, or to a field when a record is
referenced as a vector of fields.
╔════════════════════════════════════════════════════════════════════╗
║ <memvar>=<exp> ║
║ <file>[<num exp>]=<exp> ║
╚════════════════════════════════════════════════════════════════════╝
Assigning values to memory variables. The first form of this
command assigns a value to a memory variable; if the variable does not
exist, it will be created. This command is equivalent to the STORE
command (see STORE).
Treating a data file as a vector. The second form assigns a
value to a field of a data file. In this form, [ and ] do not
indicate an option, [ and ] have to be typed in. For instance,
EMPLOYEE[3] is the third field, ADDR, of the EMPLOYEE data file. This
is the only way to assign a value to a field with the = command.
Normally, field values are assigned with the REPLACE command.
Special care must be taken when using this second form when the
data file is opened with a macros (see USE). Opening a file with a
macro allows a standard program to work with a wide variety of files,
provided the compiler is told the data file structure.
Suppose a data file is opened with the following commands:
USE inven COMPILE
ACCEPT 'Enter name of data file to use: ' to fil_nam
USE &fil_nam
In this case, the compiled program assumes INVEN.DBF is in use,
even though some other file with the same structure is actually
opened. Therefore, if fil_nam='INVEN88', the proper way to reference
the 3rd field of the open data file is inven[3], not inven88[3].
Examples:
1>cost=23.89
1>qty=45
1>? cost*qty
1075.05
1>employee[1]='Steiner'
1>n=6
1>order[n+1]='Short-sleeve golf shirts'
= VPI1 VPI VPIN =
VP-Info Level 1 Reference Manual Page 133 SECTION 4
Comment: = is the only VP-Info Level 1 command verb that does not
appear at the start of the command line. All of the following are
identical in effect:
1>employee[1]='Steiner'
1>REPLACE employee[1] WITH 'Steiner'
1>REPLACE name WITH 'Steiner'
= VPI1 VPI VPIN =
VP-Info Level 1 Reference Manual Page 134 SECTION 4
?
»
Display expression or expression list.
╔════════════════════════════════════════════════════════════════════╗
║ ? [<exp list>] ║
║ ?? [<exp list>] ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ <exp list> the expression or expressions to be displayed ║
╚════════════════════════════════════════════════════════════════════╝
The ? command evaluates the expression or expressions in the list
(remember the commas to separate the expressions in the list!) and
displays the results on a new line. In particular, this command is
often used to display the contents of memory variables and fields.
The displayed items are separated by blanks if SET RAW OFF (see
the SET command; on is the default). When SET RAW ON, they appear
side by side.
? with no expression displays a blank line; it is used for
spacing on the screen and printer.
While the ? command moves the cursor to the beginning of the next
line before the items are displayed, the ?? command displays the items
at the current cursor position. The ?? command is used in programs to
build lines of text on the screen or on the printer from several
pieces.
For displaying matrices, see Section 2.5.
Examples:
1. Displaying fields:
1>USE employee
1>GO 5
1>? fname
Poyner
1>? fname,tel:no
Poyner 403-1193
2. Using the ? command as a calculator:
1>b=7
1>? 25/5+b,b*2,b*b
12.00 14.00 49.00
?/?? VPI1 VPI VPIN ?/??
VP-Info Level 1 Reference Manual Page 135 SECTION 4
3. A composite print line in a program segment (CUSTN and DEBIT
are fields in the selected file):
amount=0
mcust=custn
? 'The amount of the invoice is: '
DO WHILE custn=mcust.AND..NOT.EOF
amount=amount+debit
SKIP
ENDDO
?? amount
Note how the third and eighth command lines make one print line.
?/?? VPI1 VPI VPIN ?/??
VP-Info Level 1 Reference Manual Page 136 SECTION 4
@
Display data and data input request at specific line and column
position on screen or printer, or erase the screen line starting at
the specified coordinates.
╔════════════════════════════════════════════════════════════════════╗
║ @ <line,col> [SAY <exp> [USING <format>]] [GET <var> [PICTURE ║
║ <format>]] ║
║ ║
║ line the line number for the display, a numeric expression; ║
║ the fractional part (if any) will be discarded ║
║ col the column number for the display, numeric expression; ║
║ the fractional part (if any) will be discarded ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ none erase the screen line starting at the specified ║
║ row and column position; when printing, move print head ║
║ to specified position ║
║ ║
║ SAY <exp> [USING <format>] ║
║ ║
║ SAY displays the expression, <exp>; if there is a USING ║
║ clause, <exp> is displayed using the format ║
║ specification <format> ║
║ ║
║ GET <var> [PICTURE <format>] ║
║ GET asks for an input into the variable <var>; the present ║
║ contents of the <var> is displayed; if there is a ║
║ PICTURE clause, <var> is displayed using <format>. ║
║ The input request is activated by the READ command ║
╚════════════════════════════════════════════════════════════════════╝
The @ command is used in VP-Info Level 1 programs, first, to
display formatted data at specific locations on the screen or printer,
and second, to prompt the user to type in data (in conjunction with
the READ command). If the SET FORMAT option is TO PRINT (see the SET
FORMAT command), then the (formatted) data is sent to the printer and
there can be no GET clause; otherwise the SET FORMAT TO SCREEN is in
effect, and the data is sent to, and can be obtained from, the screen.
The keywords of the @ command: SAY, USING, GET, PICTURE cannot be
in macros.
This command is a crucial element in making input screens and
reports in VP-Info Level 1, but also consider the TEXT command, with
many features of the @ command, and is usually used in preference to @
for full-screen input and output, and printed output.
@ VPI1 VPI VPIN @
VP-Info Level 1 Reference Manual Page 137 SECTION 4
For the IBM screen, the line numbers (see the ROW() function) go
from 0 to 24, column numbers (see the COL() function) from 0 to 79.
For the printer, the line number counter begins at 0 (line 1); it is
reset to 0 by the EJECT command (see the commands: EJECT, SET EJECT,
SET LENGTH TO). If there are several @ commands for the printer, each
@ command must display past the display of the previous @ command
(that is, if the first @ command displays at line1, col1, and the next
at line2, col2, then either line1<line2, or line1=line2 and
col1<col2). If the new print position is less than the current print
position, the printer head is not moved by the @ command.
If GET <var> is used, the variable, <var> must exist; it is not
created by this command. The present value of <var> is shown on the
screen; the new value typed in by the user becomes the contents of
<var>; if <var> is a field, the field in the selected file is changed
(a REPLACE is performed).
If no option is used in screen output, for instance @ 10,0, the
line is cleared on the screen starting at the indicated column. On
the printer, the print head is moved to the new position.
If there is no <format> clause, the variable is displayed as
follows: fields are displayed with the width specified in the data
file structure; string memory variables are displayed as stored;
numeric variables are displayed as specified by the :PICTURE system
variable (see Section 2.6).
The GET clauses are activated by the READ command. There can be
no more than 64 GET clauses for a READ command. The GET clauses with
their pictures are stored in a Get Table, which remains in effect
after a READ until another GET clause is encountered or a CLEAR GETS
command is encountered. It may also be cleared when leaving the
current program module, depending on the setting of the SET GET
command (see the commands: READ, SET GET, CLEAR GETS, and ON FIELD).
Format clause. A format clause is a string composed of format
characters and background characters. The format characters format
the output, serve as holding places for characters in output, and mask
the input; the background characters are placed in the output to make
it prettier and in the input to make the input easier.
For instance, if the variable DATE is a string of blanks, the
command
@ 5,1 SAY 'Type date (mm/dd/yy) ' GET date PICTURE '99/99/99'
will display in line 5, column 1:
Type date (mm/dd/yy) / /
@ VPI1 VPI VPIN @
VP-Info Level 1 Reference Manual Page 138 SECTION 4
In this example, 9 is a format character; it accepts only digits
(0 to 9). The slash (/) is a background character; it is displayed to
help the input; the cursor jumps over the displayed / when the input
is typed. The format characters do not become part of the resulting
input.
Formatting numbers. Formatting numbers is very easy. Specify
the number of decimals, the placement of commas, and perhaps a
floating dollar sign. Here are some examples:
Number Format Display Comment
1123.89 '9,999.99' 1,123.89
1000.89 '99999' 1000 the decimals were
dropped
100.89 '$9,999.99' $ 100.89 the comma does not
appear; note the two
blanks after the $
100.89 '$,$$$.99' $100.89 the $ floats to the
number up to the last
$ in the format
100.89 '99' ** stars means number is
too large to display
100.89 '999.999' 100.890
This is how the format works both with the SAY and the GET clause
in displaying numbers; extreme care, however, must be exercised in
using format with GET when inputting values to a numeric field, since
the field and the picture must have the same number of digits before
the decimal point.
The GET clause displays the number in the variable or field;
after the READ command, VP-Info Level 1 waits for input. The input is
typed in on top of the displayed number, ignoring where the number is,
the dollar sign, commas, and the decimal point. Only digits, the
minus sign, and the decimal point are accepted. Once the input is
complete (by filling the field or by pressing <ENTER>), the new number
is reformatted by the format clause, and redisplayed.
Remember that in VP-Info Level 1, all numbers in a field have a
specified width and number of decimals; these are recorded in the data
file. It is important to understand that a GET command does not
change the width or the number of decimals for a field. The field and
the picture must have the same number of digits before the decimal
point.
@ VPI1 VPI VPIN @
VP-Info Level 1 Reference Manual Page 139 SECTION 4
The number zero is displayed as a zero (in the specified format)
or as blanks depending on whether SET ZERO is ON or OFF (the default
is ON).
To sum up: for numbers, only 9, $, the comma (,), and the period
(.) are the format characters. Any other character is a background
character, except the two characters that format negative numbers, see
below.
Numbers are displayed as specified by the :PICTURE system
variable (see Section 2.6); this can be changed by the <format>.
Formatting negative numbers. In some applications, the negative
number -241.56 should appear as 241.56- or as <241.56>. To achieve
that, simply add - or > to the end of the picture format string:
Number Format Display
-241.56 9999.99 -241.56
-241.56 9999.99- 241.56-
-241.56 9999.99> <241.56>
241.56 9999.99- 241.56
241.56 9999.99> 241.56
Formatting strings. For displaying strings, use four format
characters: 9, X (or x), A (or a), and !. Every other character is a
background character.
The format characters are just place holders for display
purposes; each one will be replaced by a character of the string to be
displayed:
String Format Display Comment
'abcd' 'xXxx' abcd x and X are the same
'abcd' '!Xxx' Abcd ! forces character to caps
'abcd' '9X9!' abcD 9 also displays letters
'abcd' 'xx' ab displays as much as it can
'abcd' 'xxxxx' abcd if the format has too many
place-holding
characters, the string
is padded with blanks
on the right
Background characters can be mixed with the format characters:
String Format Display Comment
@ VPI1 VPI VPIN @
VP-Info Level 1 Reference Manual Page 140 SECTION 4
'abcd' 'X-X-X-X' a-b-c-d - is a background
character
'abcd' '(xx)-x/x' (ab)-c/d - and / are background
characters
'2048856543' '(xxx) xxx-xxxx' (204) 885-6543 (, ), and - are
background characters
String: 'DavidBrand'
Format: "1st: xxxxx, L'st: xxxxx"
Display: 1st: David, L'st: Brand
Comment: This is an artificial example to show the pitfalls in
using background characters. In the format "1st name" will not work
instead of "1st", because a is not a background character; that is
also why "L'st" replaced "Last". Finally, note the use of " as the
format delimiter, so ' can be used in "L'st".
In GET format clauses, 9, X, A, and ! are also place holders to
display the present contents of the variable. However, when
VP-Info Level 1 receives the input after the READ command, 9, X, A,
and ! become place holders that take only certain characters:
9 takes only digits (0 to 9), - (minus), blank, and . (period)
A takes only letters (a to z and A to Z)
X takes any character
! takes any character but converts lower-case letters (a to z) to
upper case letters (A to Z)
For instance, if the memory variable tel_no contains 10 blanks,
then
@ 10,10 GET tel_no PICTURE '(999) 999-9999'
will display ( ) - , the cursor is after (, and only digits
(and -, blank, .) are accepted for input.
The @ GET <var> command does not change the length of a string
variable <var>. If the variable is a field, the width is defined when
the file was created; for a memory variable, the width is determined
by the current value.
Note that the format clause is also used by the PIC( function.
Examples:
1. Erase line 15 on the screen; or with SET PRINT ON, print a
blank line 15.
@ VPI1 VPI VPIN @
VP-Info Level 1 Reference Manual Page 141 SECTION 4
1>@ 15,0
This is the same as
1>ERASE 15,15
2. Display (print) on line 15, column 10:
1>@ 15,10 SAY name
David Simco
3. Display on line 20:
1>number=523.89
1>@ 20,12 SAY number USING '999'
523
4. Display on line 10, column 5:
1>number=7756.90
1>@ 10,5 SAY number USING '9,999.99'
7,756.90
5. Display on line 20:
1>@ 20,0 SAY number USING '$$$,$$$.99'
$7,756.90
6. Display on line 15:
1>@ 15,0 SAY name USING '!!!!!!!!!!'
DAVID SIMC
7. Display on line 2:
1>@ 2,0 SAY name USING '!!!!!!!!!!!!!!!'
DAVID SIMCO
8. Display on line 5:
1>@ 5,0 SAY name USING 'xxxxx-----xxxxx'
David----- Simc
@ VPI1 VPI VPIN @
VP-Info Level 1 Reference Manual Page 142 SECTION 4
9. Display on line 10:
1>telno='2025554321'
1>@ 10,5 SAY telno USING '(xxx) xxx-xxxx'
(202) 555-4321
10. Display "Hello" on the second line from the current line:
1>@ ROW()+2,0 SAY 'Hello'
11. Using GET and a number (possible only in a program):
a. Issue the GET command:
number=4452.78
@ 10,10 GET number PICTURE '99999.99'
This displays in line 10:
4452.78
b. Now give a READ command:
READ
The cursor is now on the first character of the number.
c. Type 7805.44, you see:
7805.448
(notice the final 8, which remained from the original value of NUMBER,
is not part of the new value; as soon as a digit is typed in a numeric
editing field, all digits to its right are marked to be cleared) the
cursor is on the last character; press <ENTER>. This gives the
display:
7,805.44
Note that background characters may not be used in a picture for
a numeric GET. No error will be shown, but the resulting values may
be not what you intend.
@ VPI1 VPI VPIN @
VP-Info Level 1 Reference Manual Page 143 SECTION 4
ACCEPT
Input request for strings.
╔════════════════════════════════════════════════════════════════════╗
║ ACCEPT ['<string>'] TO <str var> ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ '<string>' the prompt message ║
╚════════════════════════════════════════════════════════════════════╝
This command is used in VP-Info Level 1 programs to request
character information to be placed into a memory variable. The text
in <string> will be displayed as a prompt message. Note that <string>
has to be delimited by ' or by ", and may not be either a macro or a
string expression. ACCEPT cannot be used to input data into a field
or element of a matrix.
If the <memvar> does not exist, it will be created.
The optional character string is used as a prompt. A character
expression cannot be used, but a macro is permitted, provided the
macro expression includes quotation marks.
To input numeric or logical data, use the INPUT command.
Example:
In a program:
ACCEPT 'Your name: ' TO name
Your name: David Simco
The following illustrates use of a variable instead of a string
as the prompt:
1>prompt='"This is a prompt: "'
1>ACCEPT &prompt TO hello
This is a prompt: George
1>LIST MEMORY
Name Type Width Contents
PROMPT C 20 "This is a prompt: "
HELLO C 6 George
** Total ** 2 variables... 26 bytes
ACCEPT VPI1 VPI VPIN ACCEPT
VP-Info Level 1 Reference Manual Page 144 SECTION 4
APPEND
Append record to data file.
╔════════════════════════════════════════════════════════════════════╗
║ APPEND [FIELDS <field list> / TEXT <textfile>] / OFF ] ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ FIELDS <field list> the fields to be edited during APPEND ║
║ TEXT <textfile> erases the screen, displays the text ║
║ file, and then does APPEND OFF ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ OFF rather than generate an APPEND input screen, ║
║ uses an exiting screen and its Get Table ║
╚════════════════════════════════════════════════════════════════════╝
The APPEND command without either the OFF or TEXT option allows
the user to add records to the selected file. Once the command is
given, the screen shows the new record in full-screen editing mode.
For instance, if the selected file has 201 records, the screen will
show record 202 with all fields filled with blanks; once record 202 is
filled in, a blank record 203 is shown.
To exit from APPEND, use <End> (or Ctrl-W) once you have filled
in the fields of the last record desired. If all the fields of the
last record are blank, it will not be appended. To switch from APPEND
to EDIT mode, press <Pg Up>.
Note that APPEND is actually a special mode of EDIT; the only
difference is that EDIT begins by displaying the current record, while
APPEND adds a new blank record to the data file and displays that. All
the editing fields are the same as in EDIT. See the EDIT command for
the complete list of editing keys.
APPEND updates all index files in use.
Example:
1>USE employee
1>APPEND
VP-Info Level 1 goes into screen editing mode and displays record
7 with all fields blank (the box showing editing keys is displayed
when SET MENU is ON):
APPEND VPI1 VPI VPIN APPEND
VP-Info Level 1 Reference Manual Page 145 SECTION 4
──────────────────────────────────────────────────────────────────────────────
#1 EMPLOYEE.DBF APPEND Record 7
Page 1
┌────────────────────────────────────────────────────────────────────────────┐
│REC: prev <PgUp> next <PgDn> delete ^U PAGE: prev ^K next ^L │
│FILE: top ^<Home> bottom ^<End> DELETE: char <Del> to end of field ^Y │
│APPEND MODE: begin ^<PgDn> exit <PgUp> EXIT: with save <End> no save ^Q │
└────────────────────────────────────────────────────────────────────────────┘
NAME...........
FNAME..........
ADDR...........
CITY...........
STATE..........
ZIP............
TEL_NO.........
MARRIED........
SALARY.........
YEAR_EMP.......
DEPT...........
ADD_1..........
──────────────────────────────────────────────────────────────────────────────
VP-Info Level 1 offers two options that allow users to format
their APPEND and EDIT screens to their specific requirements.
APPEND OFF suppresses the standard APPEND/EDIT screen and uses an
existing screen and its associated Get Table to accept the input. It
is available only in a program.
Example in a program:
1>USE employee
1>CLS
1>TEXT add_empl
1>APPEND OFF
APPEND TEXT can be used in both conversational mode and programs.
The following combines all the steps in the above example:
Example:
1>USE employee
1>APPEND TEXT add_empl
The input screen can be constructed with either @ GET or TEXT
command. See @ and TEXT commands.
APPEND VPI1 VPI VPIN APPEND
VP-Info Level 1 Reference Manual Page 146 SECTION 4
APPEND BLANK
Append a blank record to data file.
╔════════════════════════════════════════════════════════════════════╗
║ APPEND BLANK ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ BLANK append blank record, no full-screen editing ║
╚════════════════════════════════════════════════════════════════════╝
APPEND BLANK adds a blank record to the selected file, and sets
the current record number to this record. The new record is not
shown. The fields of such a record are usually filled by the user
with the REPLACE, @ GET, or EDIT commands (or variants of these, see
the commands READ, =, TEXT, BROWSE).
APPEND BLANK updates all index files in use.
APPEND BLANK VPI1 VPI VPIN APPEND BLANK
VP-Info Level 1 Reference Manual Page 147 SECTION 4
APPEND FROM
Append data to the selected file from another file.
╔════════════════════════════════════════════════════════════════════╗
║ APPEND FROM <file> [FOR <cond>] [SDF/SDF DELIMITED [WITH <char>]] ║
║ ║
║ <file> the name of the source file ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ FOR <cond> select by condition (not with sequential source ║
║ files) ║
║ SDF sequential source file ║
║ SDF DELIMITED sequential source file with delimited fields ║
║ SDF DELIMITED WITH <char> sequential source file with fields ║
║ delimited with a specific character <char> ║
╚════════════════════════════════════════════════════════════════════╝
This command appends records from the source file <file> to the
selected file. Fields are copied from the source file to the selected
file into fields with the same name. Deleted records are not
appended.
If a field in the source file has no matching field in the
selected file, then the field is ignored. If a field in the selected
file has no matching field in the source file, then the field is set
to blank.
For character fields, if the field width gets smaller, then the
field is truncated on the right; if the field width gets larger, then
the field is padded with blanks on the right.
For number fields, if a number will not fit in the new field,
digits are lost on the left side of the number. Be careful when
moving numbers with different field widths. If the source field has
more decimals than the target field, decimals on the right will be
dropped. If the target field has too few positions to the left of the
decimal point, the value will be lost and the field filled with a zero
followed by asterisks.
The FOR clause is used to append a subset of the file specified.
The condition <cond> is made up of memory variables and the fields of
the source file; permitted only when the source is a data file.
If the structure of two data files is identical in all respects,
the records are appended very quickly; otherwise the APPEND is done
one field at a time. If a field name occurs only in the source file,
its values will not be copied into the target data file. (To change
the name of a field, use the RENAME FIELD command.)
APPEND FROM VPI1 VPI VPIN APPEND FROM
VP-Info Level 1 Reference Manual Page 148 SECTION 4
APPEND FROM updates all index files in use.
With any of the SDF options, VP-Info Level 1 reads the sequential
file, and each line is turned into a new record of the data file
appended to the end. Each line must end with a carriage return
(character 13) or a carriage return-line feed pair (characters 13 and
10). The characters of the line are placed in the new record one
after another from the left, see examples. See also the related
command: COPY TO ... SDF.
APPEND FROM ... SDF assumes that fields are not trimmed or
delimited.
With the SDF DELIMITED option, the line of the sequential file is
regarded as a number of trimmed fields, separated by commas. Strings
can, in addition, be delimited by quotation marks. These fields are
placed in the fields of the data file from the left. The remaining
fields of the data file (if any) are left blank; the remainder of the
line (after all the fields are filled), if any, is ignored.
With the SDF DELIMITED WITH <char> option, the line of the
sequential file is regarded as a number of fields, separated by
commas. Strings are trimmed, and the specified character is used to
surround strings and logical constants. Otherwise, this option is
identical to SDF DELIMITED.
The functions to read and write sequential files give much better
control over sequential files. See Section 3.
Important programming note: The APPEND FROM command automatically
opens the FROM file in its internal work area; if the FROM file is
already open in another work area, the compiler will assume it is
closed when the APPEND FROM command is passed during execution, even
if that command is in an IF, CASE or other structure module that is
not executed!
Therefore, if there is any reference to the FROM file later in
the program, open the file in the proper work area again immediately
after the APPEND FROM command. If it is not actually needed after the
APPEND FROM is executed (e.g., the program exits after the APPEND
FROM), open it with the COMPILE keyword. Example:
USE#4 invoices COMPILE
Examples:
1. Appending from a file with the same structure:
1>USE employee
APPEND FROM VPI1 VPI VPIN APPEND FROM
VP-Info Level 1 Reference Manual Page 149 SECTION 4
1>COPY STRUCTURE TO empl1
1>USE empl1
1>APPEND FROM employee FOR name < 'Q'
3 APPEND(S)
1>LIST name
1 Marek
2 Balzer
3 Poyner
1>ZAP
1>APPEND FROM employee FOR tel_no < '5'
1 APPEND(S)
2. Appending from a file with a different structure. Append from
EMPLOYEE.DBF.
The selected file is:
Datafile name : EMPL2.DBF
Number of records: 0
Database selected is #1
Field Name Type Width Dec
1 NAME C 15
2 NAME1 C 10
3 ADDR C 5
4 CITY C 25
5 STATE C 2
6 ZIP C 5
7 TEL_NO C 8
8 MARRIED L 1
9 SALARY N 2 0
10 YEAR_EMP N 6 2
11 DEPT C 15
** Record Length ** 95
EMPL2 has a field NAME1 that does not occur in EMPLOYEE; the
field FNAME in EMPLOYEE does not occur in EMPL2.
The ADDR field in EMPLOYEE has width 20, in EMPL2 it has width 5.
The CITY field in EMPLOYEE has width 20, in EMPL2 it has width 25.
The SALARY field in EMPLOYEE has width 9, in EMPL2 it has width 2.
The YEAR_EMP field in EMPLOYEE has width 4, in EMPL2 it has width 6;
but only 3 characters are available for the number to the left of the
decimal point.
1>USE empl2
1>APPEND FROM employee
6 APPEND(S)
1>EDIT 1
APPEND FROM VPI1 VPI VPIN APPEND FROM
VP-Info Level 1 Reference Manual Page 150 SECTION 4
──────────────────────────────────────────────────────────────────────────────
#1 EMPL2.DBF EDIT Record 1
Page 1
┌────────────────────────────────────────────────────────────────────────────┐
│REC: prev <PgUp> next <PgDn> delete ^U PAGE: prev ^K next ^L │
│FILE: top ^<Home> bottom ^<End> DELETE: char <Del> to end of field ^Y │
│APPEND MODE: begin ^<PgDn> exit <PgUp> EXIT: with save <End> no save ^Q │
└────────────────────────────────────────────────────────────────────────────┘
NAME........... Marek
NAME1..........
ADDR........... 231 R
CITY........... Broomsdale
STATE.......... MD
ZIP............ 02110
TEL_NO......... 566-7012
MARRIED........ y
SALARY......... 0*
YEAR_EMP....... 0*****
DEPT........... Maintenance
──────────────────────────────────────────────────────────────────────────────
Note that ADDR was cut down to 5 characters; CITY was padded by 5
blanks; SALARY and YEAR_EMP indicate that there was not enough room
for the numbers.
3. Appending with the SDF option.
Use the EMPLOYEE file, and append from a sequential file:
DATA.TXT. Give the commands:
1>USE employee
1>APPEND FROM DATA SDF
Let the first line of DATA.TXT be:
Smith Robert 412 River Street
then the first three fields will be correctly placed. Note that the
APPEND with SDF does not check for data correctness (numbers into
numeric fields), for field width, etc. This option can be used if
some other program already formatted the sequential file in absolute
conformity with the structure of the data file.
4. APPEND with the SDF DELIMITED option is easier to use.
Continuing the previous example,
Smith,Robert,412 River Street
APPEND FROM VPI1 VPI VPIN APPEND FROM
VP-Info Level 1 Reference Manual Page 151 SECTION 4
or
'Smith','Robert','412 River Street'
would do. It is important to have the fields delimited with quotation
marks if any field contains a comma. Fields for which no data is
supplied should be represented by commas as "place holders." For
instance,
,,'412 River Street'
5. APPEND with the SDF DELIMITED WITH <char> option works the
same way.
Continuing the previous example, the command
APPEND FROM source SDF DELIMITED WITH |
working on the following line
|Smith|,|Robert|,|412 River Street|
would append the record correctly. The use of a specified character
other than single quote reduces or eliminates the concern about having
commas, apostrophes and quotation marks in field contents. Fields for
which no data is supplied should be represented by the specified
character as "place holders." For instance,
||,||,412 River Street|
APPEND FROM VPI1 VPI VPIN APPEND FROM
VP-Info Level 1 Reference Manual Page 152 SECTION 4
APPEND TO
Append current record to another file.
╔════════════════════════════════════════════════════════════════════╗
║ APPEND TO <num const> ║
║ ║
║ <num const> append record to file in select area <num const> ║
╚════════════════════════════════════════════════════════════════════╝
This command appends the current record from the selected file to
the file numbered <num const>. The same rules apply as in the APPEND
FROM command.
You can also append to the same file by giving its file number.
Examples:
1. Interactive use. There is a Backorder File; you are looking
through it with EDIT or BROWSE to find which orders should be filled.
Store "^Q;APPEND TO 4;BROWSE;^X;" into a function key, and whenever an
order to ship is found, you press the function key. File 4 is the
file of orders to be shipped.
2. There is a Name-and-Address file, and a label printing program
that prints a whole file, the Label file. The Name-and-Address file
is searched by the above method, and APPEND TO is used to put the
addresses to be printed in the Label file.
3. A program segment. File 2 is a backorder file; each record
contains 25 fields including Q1 to Q8, the quantities for the eight
sizes. This program segment asks how much of each size should be
shipped; the end result is that the items to be shipped are appended
to the end of File 2, while the original record is changed to reflect
the shipped quantities.
SELECT 2
STORE # TO gback
APPEND TO 5
@ y,35 GET q1
@ y,39 GET q2
@ y,43 GET q3
@ y,47 GET q4
@ y,51 GET q5
@ y,55 GET q6
@ y,59 GET q7
@ y,63 GET q8
READ
REPLACE quant WITH q1+q2+q3+q4+q5+q6+q7+q8
APPEND TO VPI1 VPI VPIN APPEND TO
VP-Info Level 1 Reference Manual Page 153 SECTION 4
SELECT 5
REPLACE q1 WITH q1-q1#2,q2 WITH q2-q2#2,q3 WITH q3-q3#2
REPLACE q4 WITH q4-q4#2,q5 WITH q5-q5#2,q6 WITH q6-q6#2
REPLACE q7 WITH q7-q7#2,q8 WITH q8-q8#2
REPLACE quant WITH q1+q2+q3+q4+q5+q6+q7+q8
REPLACE type WITH 'O'
APPEND TO 2
SELECT 2
GOTO gback
APPEND TO VPI1 VPI VPIN APPEND TO
VP-Info Level 1 Reference Manual Page 154 SECTION 4
AVERAGE
Average numeric expressions for selected records.
╔════════════════════════════════════════════════════════════════════╗
║ AVERAGE <num exp list> [TO <memvar list>] [<scope>] [FOR <cond>] ║
║ ║
║ <num exp list> the numeric expressions to average ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ <memvar list> store the results in these memory variables ║
║ <scope> select by scope (default scope: ALL) ║
║ FOR <cond> select by condition ║
╚════════════════════════════════════════════════════════════════════╝
The command AVERAGE adds up numeric expressions for selected
records of the selected data file and divides the result with the
number of records summed. Up to 10 expressions can be averaged with
one command. Optionally, the results can be stored in numeric memory
variables; the expression list and the numeric memory variable list
should have the same number of entries. <memvar list> cannot contain
numeric matrix variables.
Records flagged as DELETED are not averaged.
Memory variables in <memvar list> need not exist; if any variable
in the <memvar list> does not exist, this command creates it.
Example:
The average earning of the employees (in the data file EMPLOYEE),
and the average year employment began:
1>USE employee
1>AVERAGE salary, year_emp
6 AVERAGE(S)
32502.16 1980.50
AVERAGE VPI1 VPI VPIN AVERAGE
VP-Info Level 1 Reference Manual Page 155 SECTION 4
BINLOAD
Load a binary (assembly-language) program into memory.
╔════════════════════════════════════════════════════════════════════╗
║ BINLOAD <programname> ║
║ ║
║ <programname> a binary file to be executed under ║
║ VP-Info Professional (not available under ║
║ Level 1); default extension BIN ║
╚════════════════════════════════════════════════════════════════════╝
VP-Info Professional only: Assembly-language programs may be
copied from disk into a special area of memory called BINSPACE, which
must be set aside with the BINSPACE= command in your VPI.SET or
VPIN.SET file.
When no longer needed, the program can be removed from the
BINSPACE with the BINUNLOAD command, allowing room for another binary
program to take its place. A maximum of eight binary files, with
default extension BIN, may be loaded into memory at one time.
Once loaded into the BINSPACE, the program may be executed with
the CALL command (see the CALL and BINUNLOAD commands).
Examples:
1>BINLOAD test
BINLOAD VPI VPIN BINLOAD
VP-Info Level 1 Reference Manual Page 156 SECTION 4
BINLOAD VPI VPIN BINLOAD
VP-Info Level 1 Reference Manual Page 157 SECTION 4
BINSPACE=
Reserve space in memory to BINLOAD binary files to be run with the
CALL command.
╔════════════════════════════════════════════════════════════════════╗
║ BINSPACE= <blocks> ║
║ ║
║ VP-Info Professional only VPI.SET file only ║
║ ║
║ <blocks> the number of 1K blocks of RAM to be reserved ║
║ for loading BIN files with the BINLOAD command ║
╚════════════════════════════════════════════════════════════════════╝
VP-Info Professional only: Assembly-language programs may be
copied from disk into a special area of memory called BINSPACE, which
must be set aside with the BINSPACE= command in your VPI.SET or
VPIN.SET file.
The number of 1K blocks, to a maximum of 32, must be specified.
The BINSPACE is allocated above VP-Info Level 1's 64K data space
and high memory, and reduces the amount of DOS memory available to
execute commands with the RUN command.
Once loaded into the BINSPACE with BINLOAD, the program may be
executed with the CALL command (see the CALL, BINLOAD, and BINUNLOAD
commands).
Examples:
1>BINSPACE=16
BINSPACE= VPI VPIN BINSPACE=
VP-Info Level 1 Reference Manual Page 158 SECTION 4
BINUNLOAD
Remove a binary (assembly-language) program from memory.
╔════════════════════════════════════════════════════════════════════╗
║ BINUNLOAD <programname> ║
║ ║
║ <programname> a binary file to removed from memory by ║
║ VP-Info Professional (not available under ║
║ Level 1); default extension BIN ║
╚════════════════════════════════════════════════════════════════════╝
VP-Info Professional only: Assembly-language programs, which are
loaded into a special area of memory called BINSPACE by the BINLOAD
command, may be removed from memory by the BINUNLOAD command when no
longer needed.
This allows room for another binary program to take its place. A
maximum of eight binary files, with default extension BIN, may be
loaded into memory at one time.
Care should be taken not to create "holes in memory" by loading
and unloading BIN files indiscriminately. For best performance, users
are urged to load frequently called binary files first and not unload
them; then transient or occasional binary programs can be loaded,
called and immediately unloaded with the BINUNLOAD command.
(See BINLOAD and CALL commands.)
Examples:
1>BINUNLOAD test
BINUNLOAD VPI VPIN BINUNLOAD
VP-Info Level 1 Reference Manual Page 159 SECTION 4
BOX
Draw a box on the screen.
╔════════════════════════════════════════════════════════════════════╗
║ BOX <line1>,<col1>,<line2>,<col2> [DOUBLE] ║
║ ║
║ <line1>,<col1> the position of the upper-left corner of the box ║
║ <line2>,<col2> the position of the lower-right corner of the box ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ DOUBLE use double line graphics, the default is single-line ║
╚════════════════════════════════════════════════════════════════════╝
The command BOX draws a box on the screen using the character
graphics of the IBM monochrome screen. If line1=line2, a horizontal
line is drawn. If col1=col2, a vertical line is drawn.
line1, line2, col1, col2 can all be numbers or numeric
expressions; any fractional part will be disregarded
This command is useful for making menus pretty, and for
partitioning the screen into different viewing areas.
Note that commas are required between the numeric expressions
used for the corner specifications, but a comma is NOT permitted
before the DOUBLE keyword.
The WINDOW command can also draw a box, but in addition limits
relative screen output to the boundary of the window and can
optionally set window and box colors. See the WINDOW command.
Examples:
1>ERASE
1>BOX 2,10,12,40
1>ERASE
1>BOX 3,0,8,20 DOUBLE
1>ERASE
1>BOX 10,0,10,70
BOX VPI1 VPI VPIN BOX
VP-Info Level 1 Reference Manual Page 160 SECTION 4
BREAK
Exit to the bottom of a DO WHILE or REPEAT loop.
╔════════════════════════════════════════════════════════════════════╗
║ BREAK ║
╚════════════════════════════════════════════════════════════════════╝
The BREAK command is used only in programs, in a DO WHILE or a
REPEAT loop to exit at the bottom of the loop. If there are nested
loops, the exit is at the bottom of the innermost loop. See DO WHILE
and REPEAT.
Contrast the command BREAK with the command LOOP which executes
the condition at the top of the DO WHILE loop (see the LOOP command).
Caution: BREAK can be used only within a DO WHILE or REPEAT loop;
use anywhere else is an error with unpredictable results.
Example:
DO WHILE T
<program segment>
IF custn<>mcust
BREAK
ENDIF
<program segment2>
ENDDO
This program carries out <program segment> and <program segment2>
until CUSTN becomes different from MCUST; then it jumps over <program
segment2> and leaves the loop.
BREAK VPI1 VPI VPIN BREAK
VP-Info Level 1 Reference Manual Page 161 SECTION 4
BROWSE
Edit fields in many records.
╔════════════════════════════════════════════════════════════════════╗
║ BROWSE [FIELDS <field list>]/[OFF]/[TEXT <textfile>] [APPEND] ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ FIELDS <field list> specify the fields to be displayed ║
║ APPEND add a blank record and start BROWSE in that record ║
║ OFF rather than generate a BROWSE input screen, uses an ║
║ exiting screen and its Get Table ║
║ TEXT <textfile> erases the screen, displays the text file, and ║
║ then does BROWSE OFF ║
╚════════════════════════════════════════════════════════════════════╝
The BROWSE command displays the records (from the current record
on) horizontally, one at a line; it displays as many fields as will
fit on a line. A column represents a field.
If the selected file is indexed, the records are displayed in the
indexed order.
When the APPEND keyword is used, a blank record is appended to
the data file and BROWSE begins in that record. The user may alternate
between normal BROWSE and APPEND modes with the Ctrl-<PgDn> and <PgUp>
editing keys.
All the full-screen editing keys can be used. Note that they
have the same meaning as in EDIT, but sometimes they look different.
For instance, the next record command (<PgDn> or Ctrl-C) gives a new
screen in EDIT; in BROWSE, it simply moves the cursor down one line.
Editing keys:
<Left> or Ctrl-S moves the cursor back one character
<Right> or Ctrl-D moves the cursor forward one character
Ctrl-<Left> moves to the beginning of the field
Ctrl-<Right> moves to the end of the field
<Ins> or Ctrl-V puts you in insert mode: what you type gets
inserted (normally, you are in
overtype mode: what you type overtypes the
existing text); pressing <Ins> or Ctrl-V
again, puts you back into overtype mode
<BACKSPACE> deletes the character to the left of the
cursor
<Del> or Ctrl-G deletes the character on the cursor
Ctrl-Y deletes the rest of the field
BROWSE VPI1 VPI VPIN BROWSE
VP-Info Level 1 Reference Manual Page 162 SECTION 4
<Up> or Ctrl-E moves the cursor to the previous field
<Dn> or Ctrl-X moves the cursor to the next field
Ctrl-<Pg Dn> Enters APPEND mode; adds a blank record and
places the cursor in that new record
Ctrl-Q quits and does not update the current record
<End> or Ctrl-W quits and updates the current record
<PgUp> or Ctrl-R moves to the previous record; when in APPEND
mode, exist to normal BROWSE mode
<PgDn> or Ctrl-C moves to the next record
Ctrl-L redraws the BROWSE screen with the next
screenful of fields, referred to as the
next "page"; if the file has no more
fields, this key is ignored
Ctrl-K redraws the BROWSE screen with the previous
screenful of fields, referred to as the
prior "page"; if the screen is already at
the first field, this key is ignored
Alt-E skips one screenful of record toward the
beginning of the file and redisplays the
BROWSE screen
Alt-X skips one screenful of record toward the end
of the file and redisplays the BROWSE
screen
Alt-W when the cursor is in a memo field, edit the
current memo (if no current memo, one is
created) and allow changes to be saved
Alt-R when the cursor is in a memo field, view the
current memo in read-only mode; no changes
are saved
BROWSE should be used to edit columns of data in a data file;
that is, to edit a few fields of a number of records. Use the command
EDIT to edit many fields of a single records at the same time.
The option FIELDS <field list> selects the fields to be displayed
on the screen.
SET MENU ON causes a small display at the top of the BROWSE
screen, giving the use of major editing key.
Examples:
1>USE customer
1>BROWSE
Displays the following:
BROWSE VPI1 VPI VPIN BROWSE
VP-Info Level 1 Reference Manual Page 163 SECTION 4
──────────────────────────────────────────────────────────────────────────────
#1 CUSTOMER.DBF VP-Info BROWSE
Page 1
┌────────────────────────────────────────────────────────────────────────────┐
│REC: prev <PgUp> next <PgDn> delete ^U SCROLL: left ^K right ^L │
│FILE: top ^<Home> bottom ^<End> DELETE: char <Del> to end of field ^Y │
│APPEND MODE: begin ^<PgDn> exit <PgUp> EXIT: with save <End> no save ^Q │
└────────────────────────────────────────────────────────────────────────────┘
CUSTNU FIRSTNAME LASTNAME ADDRESS
1 BROS50 Stan Brown 786 Alexander Rd.
2 BURS50 Sid Bursten 876 Main St.
3 GRAG50 George Gratzer 876 Arlington Avenue
4 MELB50 Bernie Melman 9876 Ocean View Parkway
──────────────────────────────────────────────────────────────────────────────
To edit the home and work telephone numbers of the customers,
issue the command:
1>USE customer
1>BROWSE FIELDS name,hphone,wphone
The display:
──────────────────────────────────────────────────────────────────────────────
#1 CUSTOMER.DBF VP-Info BROWSE
Page 1
┌────────────────────────────────────────────────────────────────────────────┐
│REC: prev <PgUp> next <PgDn> delete ^U SCROLL: left ^K right ^L │
│FILE: top ^<Home> bottom ^<End> DELETE: char <Del> to end of field ^Y │
│APPEND MODE: begin ^<PgDn> exit <PgUp> EXIT: with save <End> no save ^Q │
└────────────────────────────────────────────────────────────────────────────┘
LASTNAME HPHONE WPHONE
1 Brown 9238423472 3984747238
2 Bursten 7658956 6575777
3 Gratzer 7866457 7657655
4 Melman 8765678 6765777
──────────────────────────────────────────────────────────────────────────────
VP-Info Level 1 offers two options that allow users to format
their BROWSE screens to their specific requirements.
BROWSE VPI1 VPI VPIN BROWSE
VP-Info Level 1 Reference Manual Page 164 SECTION 4
BROWSE OFF suppresses the standard BROWSE screen and uses an
existing screen and its associated Get Table to accept the input. It
is available only in a program.
Example in a program:
1>USE employee
1>CLS
1>TEXT add_empl
1>BROWSE OFF
BROWSE TEXT can be used in both conversational mode and programs.
The following combines all the steps in the above example:
Example:
1>USE employee
1>BROWSE TEXT add_empl
The input screen can be constructed with either @ GET and TEXT
command. See @ and TEXT commands.
NOTES
1. BROWSE OFF is preferred over BROWSE TEXT is programs because
an ON FIELD structure can be placed between the TEXT and the BROWSE
commands to give programmers total control over the BROWSE process
2. <textfile>, when used in BROWSE TEXT, can be a DOS file, a
library volume in the current library (addressed as .<volume>), or
a memo in a current data file (address as M.<memo>).
3. Horizontal scrolling is available only with BROWSE and
BROWSE FIELDS, and not with BROWSE TEXT or BROWSE OFF.
BROWSE VPI1 VPI VPIN BROWSE
VP-Info Level 1 Reference Manual Page 165 SECTION 4
CALL
Execute a binary (assembly-language) program
╔════════════════════════════════════════════════════════════════════╗
║ CALL <programname> [<argument>] ║
║ ║
║ <programname> a binary file to be executed under ║
║ VP-Info Professional (not available under ║
║ Level 1); default extension BIN ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ <argument> a character memory variable used to transfer data ║
║ to and from a BIN program; maximum 254 characters ║
╚════════════════════════════════════════════════════════════════════╝
VP-Info Professional only: Assembly-language programs, which have
been copied from disk into a special area of memory called BINSPACE,
can be executed internally by VP-Info Professional.
Running a binary file requires three steps:
1. Allocate memory in the VPI.SET or VPIN.SET file using the
BINSPACE=n where <n> is the number of 1K blocks to allocate
to the BINSPACE in memory. The limit for <n> is 32.
Example: BINSPACE=32 allocates 32K.
2. BINLOAD the program. A program need only be loaded once
(unless it is removed with the BINUNLOAD command).
Additional requests to BINLOAD the program will reload it in
the same memory space. Up to eight binary programs may be
loaded at once. Example: BINLOAD test. (BIN program may be
removed from memory with the BINUNLOAD command.)
3. CALL the binary program, with an optional argument of up to
254 bytes in a memory variable. The binary program may
modify or replace the contents of this variable, but may not
create or lengthen the contents; when execution is
completed, the variable will have a new value.
See BINLOAD and BINUNLOAD commands.
Example:
The binary program, listed below, merely overwrites the first
three characters of a passed string with the string "VPI".
dummy='1234567890'
CALL test dummy
CALL VPI VPIN CALL
VP-Info Level 1 Reference Manual Page 166 SECTION 4
? dummy
The current value of dummy would then be printed: "VPI4567890".
Rules for BIN programs:
1. BIN programs are created in assembly language and assembled
into an OBJ file with Microsoft's MASM program or
equivalent, linked into a EXE file with LINK or equivalent,
and converted into a BIN file with the DOS utility EXE2BIN.
2. The following is an example of an assembly-language module
that accepts an input string in a memory-variable passed to
the module on the CALL command line, modifies it, and passes
it back in the same memory variable.
─────────────────────────────────────────────────────────────────
; TESTBIN.ASM -- A sample program to illustrate the
; VP-Info BINLOAD and CALL facilities
;
; By Bernie Melman, Sub Rosa Publishing Inc.
;
; This routine replaces the first three characters
; in a passed string with the characters VPI
;
; Assemble with MASM version 5.0
; LINK to produce an EXE file (ignore the "No stack" warning)
; EXE2BIN to generate BIN file
;
_prog segment byte
assume cs:_prog
dtest proc far
mov [bx+0], byte ptr 'V'
mov [bx+1], byte ptr 'P'
mov [bx+2], byte ptr 'I'
mov ax,0 ;try changing bp to see if VP-Info
; can recover regs ok
mov bp,ax ;do it
ret
dtest endp
_prog ends
end
─────────────────────────────────────────────────────────────────
3. No argument is required, but if one is used, it must contain
a string which the program can evaluate in location BX.
VP-Info places a NUL (zero byte) after the string as a
terminator; if the program processes characters until a zero
is encountered in a byte, the entire string has been
processed. Any part of the string following the NUL is
ignored by VP-Info.
CALL VPI VPIN CALL
VP-Info Level 1 Reference Manual Page 167 SECTION 4
4. The maximum length of a VP-Info string is 254 bytes;
therefore, no more than 254 characters can be communicated
to or from a binary program.
5. The BIN program cannot change the memory allocation of the
argument variable. Therefore, it cannot successfully enlarge
the argument string. It can shorten the result by
terminating the result with a NUL (zero byte).
6. Sufficient space to load binary files must be provided with
the BINSPACE= command in the VPI.SET or VPIN.SET file; and
no more than eight binary files may be loaded at any one
time. BIN files can be removed from memory with the
BINUNLOAD command.
CALL VPI VPIN CALL
VP-Info Level 1 Reference Manual Page 168 SECTION 4
CANCEL
Leave VP-Info Level 1 program.
╔════════════════════════════════════════════════════════════════════╗
║ CANCEL ║
╚════════════════════════════════════════════════════════════════════╝
The command CANCEL aborts the VP-Info Level 1 program and enters
the interactive mode; the VP-Info Level 1 prompt appears. See also
QUIT.
Example:
A VP-Info Level 1 program segment:
CASE ans='8'
QUIT
CASE ans='9'
CANCEL
If the user chooses to go into VP-Info Level 1 (option 9), show
the VP-Info Level 1 prompt. Option 8 exits to the operating system.
CANCEL VPI1 VPI VPIN CANCEL
VP-Info Level 1 Reference Manual Page 169 SECTION 4
CASE
The switch in the DO CASE program structure.
╔════════════════════════════════════════════════════════════════════╗
║ CASE <cond> ║
║ ║
║ <cond> if this condition is satisfied, the following program ║
║ segment should be executed ║
╚════════════════════════════════════════════════════════════════════╝
CASE is the keyword in the DO CASE program structure.
VP-Info Level 1 evaluates the condition; if the condition is true, the
following program segment is executed. The program segment is
terminated by the next CASE, by OTHERWISE, or by ENDCASE. After the
execution of the program segment, the program execution continues with
the program line after the ENDCASE command. If the condition is
false, VP-Info Level 1 looks for the next CASE command. If no
condition is true, VP-Info Level 1 executes the program segment
following the OTHERWISE command (if any).
Note that when more than one <cond> is true in a DO CASE
structure, only the program segment for the first is executed.
See the command DO CASE.
CASE VPI1 VPI VPIN CASE
VP-Info Level 1 Reference Manual Page 170 SECTION 4
CHAIN
Leave the current VP-Info Level 1 program and start running a new
VP-Info Level 1 program.
╔════════════════════════════════════════════════════════════════════╗
║ CHAIN <program> ║
║ ║
║ <program> the name of the VP-Info Level 1 program to be run ║
╚════════════════════════════════════════════════════════════════════╝
The command CHAIN is used for executing a VP-Info Level 1 program
from within another VP-Info Level 1 program or in the interactive mode
from the VP-Info Level 1 prompt. The program name <program> should
not have an extension. If there is a compiled program by this name
(normal extension CPL; runtime extension RPL), it will be run. If
there is none, VP-Info Level 1 will run the uncompiled program
(extension PRG).
CHAIN does a CLEAR first, except that all global memory variables
are preserved and passed to the <program>; to use them, the <program>
must have a GLOBAL command declaring the variables. (See the commands
CLEAR and GLOBAL.)
The CHAIN command does not return to the calling program; the
program in memory is replaced by the program it chains to.
CHAIN is the most efficient way for one program to call another.
The DO command calls a subroutine from the disk. DO can often be
replaced by PERFORM or by CHAIN. (See the commands DO and PERFORM.
When you chain from one program to another, VP-Info Level 1
executes a CLEAR command before the start of the program, closing all
the data files, index files, sequential files, and releasing all (but
the global) variables. When you DO one program from another, the
subroutine you do inherits the existing environment -- memory
variables, data files, index files, etc. -- and returns to the DOing
program when completed or when a RETURN command is executed.
CHAIN allows the program name to be a macro.
CHAIN VPI1 VPI VPIN CHAIN
VP-Info Level 1 Reference Manual Page 171 SECTION 4
Example:
DO CASE
CASE ans='1'
CHAIN prog1
CASE ans='2'
CHAIN prog2
CASE ans='3'
CHAIN prog3
ENDCASE
This program segment chains to three different programs,
depending on the value of ANS.
CHAIN VPI1 VPI VPIN CHAIN
VP-Info Level 1 Reference Manual Page 172 SECTION 4
CLEAR
Close all data files and index files, and clear memory variables.
Optionally clear current Get Table or keyboard buffer.
╔════════════════════════════════════════════════════════════════════╗
║ CLEAR [GETS/KEYBOARD] ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ GETS clear the Get Table from memory ║
║ KEYBOARD delete all characters from the keyboard buffer ║
║ buffer ║
╚════════════════════════════════════════════════════════════════════╝
The CLEAR command with no options closes all open data files and
index files, and releases all memory variables, including the matrix
variables. (Sequential files, DOS files, system variables, and in
particular, function keys, are not effected).
Example:
1>a=2
1>name='David Barberr'
1>avco='clear'
1>LIST MEMORY
Name Type Width Contents
A N 8 2
NAME C 13 David Barberr
AVCO C 5 clear
** Total ** 3 Variables used 26 Bytes used
1>CLEAR
1>LIST MEMORY
Name Type Width Contents
** Total ** 0 Variables used 0 Bytes used
CLEAR GETS removes the current Get Table from memory. (See READ
and ON FIELD commands.)
CLEAR KEYBOARD eliminates any characters held in the keyboard
buffer. Normally, characters typed at the keyboard are stored in a
special buffer until VP-Info Level 1 in ready to process them, but
occasionally the programmer will want to be sure nothing is in the
buffer before executing certain commands. For example, CLEAR KEYBOARD
before executing the MENU() function to ensure that a key pressed
earlier in the program, or even in a previous program, does not
inadvertently trigger a menu selection.
CLEAR VPI1 VPI VPIN CLEAR
VP-Info Level 1 Reference Manual Page 173 SECTION 4
Caution to dBASE programmers: The CLEAR command in dBASE III and
later versions erases the screen, but its function on
VP-Info Level 1 is radically different. To clear the screen, use
the CLS command.
CLEAR VPI1 VPI VPIN CLEAR
VP-Info Level 1 Reference Manual Page 174 SECTION 4
CLOSE
Close the selected file.
╔════════════════════════════════════════════════════════════════════╗
║ CLOSE [ALL] ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ ALL close all data files in use ║
╚════════════════════════════════════════════════════════════════════╝
The CLOSE command closes the selected data file, updates all
information to the disk, and releases the data record buffer space
(see Appendix A.1) used by this file. Any index files attached to the
data file are also closed, and any limits, relations and filters
associated with the data file are cleared.
With the option ALL, all data files in use are closed.
Examples:
1>CLOSE
1>CLOSE#3
1>CLOSE ALL
CLOSE VPI1 VPI VPIN CLOSE
VP-Info Level 1 Reference Manual Page 175 SECTION 4
CLS
Erase screen.
╔════════════════════════════════════════════════════════════════════╗
║ CLS [<line1>,<line2>] ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ <line1>,<line2> erase from line1 to line2 ║
╚════════════════════════════════════════════════════════════════════╝
This command erases the screen, and is a synonym for ERASE.
If, optionally, two numeric expressions, line1 and line2, are
given, it erases line1 and line2, and all lines between, if any.
These expressions should have values between 0 and 24.
CLS is the same as the following three commands:
ERASE
CLS 0,24
ERASE 0,24
Examples:
1>CLS
1>CLS 2,4
1>CLS 12,12
CLS VPI1 VPI VPIN CLS
VP-Info Level 1 Reference Manual Page 176 SECTION 4
COLOR
Set the color attributes of a box on the screen.
╔════════════════════════════════════════════════════════════════════╗
║ COLOR <attrib>,<line1>,<col1>,<line2>,<col2>[,<fillchar>] ║
║ ║
║ <attrib> numeric expression between 0 and 255, the attribute ║
║ <line1>,<col1> the position of the upper-left corner of the box ║
║ <line2>,<col2> the position of the lower-right corner of the box ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ <fillchar> the ASCII number of the character used to fill the ║
║ colored area; every character position enclosed ║
║ in the area described by the row and column values ║
║ is changed to the fill character ║
╚════════════════════════════════════════════════════════════════════╝
Every character displayed on the screen has an attribute byte
that determines how the character is displayed. For monochrome
monitors, the character may be bold, underlined, reverse, and so on.
For color monitors, both the background and the character has color.
These attribute bytes are set for a rectangular area by this command.
The area is given by four numeric expressions -- line1, col1,
line2, col2 -- as in the BOX and WINDOW commands. The values must be
separated by commas.
For color monitors, compute ATTRIB by adding up (up to) four
numbers: background+foreground+blink+brightness from the following
tables:
background 0 - black
16 - blue
32 - green
48 - cyan
64 - red
80 - magenta
96 - brown
112 - white
foreground 0 - black
1 - blue
2 - green
3 - cyan
4 - red
5 - magenta
6 - brown
COLOR VPI1 VPI VPIN COLOR
VP-Info Level 1 Reference Manual Page 177 SECTION 4
7 - white
blink 0 - no blink
128 - blink
brightness 0 - normal
8 - intense
For monochrome monitors the five important numbers are:
standard white on black: 7
underline: 1
reverse video: 112
to get bold: add 8
to make it blink: add 128
See also SET COLOR TO <num exp> and :COLOR=<num exp>, which set
the attribute bytes of the characters displayed. SET COLOR TO 0 turns
the command off: the attribute bytes remain unchanged at the displaced
locations. If a part of the screen already has attributes set by the
COLOR command and SET COLOR TO 0, the newly displayed characters will
keep the attributes set by the COLOR command.
When filling an area with a fill character, as is often done in
designing sign-on screens for example, the pattern characters 176 to
178 and the solid reverse character 219 are especially useful.
Examples:
1.
1>COLOR 20,2,0,12,79
sets background blue and foreground red in lines 2 to 12.
2.
1>back=80
1>foregrnd=1
1>bright=8
1>line=2
1>col=0
1>x=18
1>y=50
1>COLOR back+foregrnd+bright,line,col,line+x,col+y
3.
1>COLOR 17,2,10,4,12
COLOR VPI1 VPI VPIN COLOR
VP-Info Level 1 Reference Manual Page 178 SECTION 4
underlines the text in a small box three lines deep and 3 characters
wide on a monochrome monitor.
4. The following program illustrates the use of the COLOR command
on a color monitor:
DIM NUM matrix[10]
REPEAT 10 TIMES VARYING i
matrix[i]=MOD(i,7)*16+7
ENDREPEAT
ERASE
REPEAT 10 TIMES VARYING i
COLOR matrix[i], 12-i, i*5, 12+i, 10+i*5
DELAY .5
ENDREPEAT
ERASE
COLOR 23, 0, 0, 24, 79
REPEAT 10 TIMES VARYING i
BOX 1+i, 7+i*3, 23-i, 73-i*3
DELAY .15
ENDREPEAT
REPEAT 10 TIMES VARYING i
COLOR matrix[i], 1+i, 7+i*3, 23-i, 73-i*3
DELAY .5
ENDREPEAT
5. All output to an area of the screen may be made invisible by
making the background and the foreground color the same. For example,
SET COLOR TO 0
COLOR 0,10,0,13,79
turns rows 10 to 13 to black on black. Editing fields for entering
passwords may be so protected.
6. A set of overlapping frames can be created with pattern
characters used as fill:
COLOR 7,10,10,16,70,176 ;a shadow pattern
COLOR 7,09,09,15,69,219 ;a solid pattern
COLOR 7,10,10,14,69,32 ;fill with blanks to create area for text
COLOR VPI1 VPI VPIN COLOR
VP-Info Level 1 Reference Manual Page 179 SECTION 4
COMPILE
Compile a VP-Info Level 1 program.
╔════════════════════════════════════════════════════════════════════╗
║ COMPILE <file> [LINK] ║
║ ║
║ <file> the name of the program file ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ LINK If SET DO OFF, causes COMPILE to work as if SET DO ON ║
╚════════════════════════════════════════════════════════════════════╝
The COMPILE command may be given in interactive mode, or in a
program:
1>COMPILE prog
where PROG is a file with PRG extension, the source program to be
compiled. <file> cannot be a macro, and should not have any extension
specified.
If you wish to compile many programs in one step, create a
program (call it, say, PROJ.PRG) as follows:
COMPILE prog1
COMPILE prog2
COMPILE prog3
Then
1>DO proj
will compile PROG1, PROG2, PROG3. Such a program should not use any
memory variables, since a CLEAR is executed before every COMPILE
command.
SET ECHO ON to have all program lines displayed as they are
compiled.
See also Section 1.
COMPILE VPI1 VPI VPIN COMPILE
VP-Info Level 1 Reference Manual Page 180 SECTION 4
CONTINUE
Continue to LOCATE from the current record.
╔════════════════════════════════════════════════════════════════════╗
║ CONTINUE ║
╚════════════════════════════════════════════════════════════════════╝
CONTINUE will carry on locating from the current record using the
condition of the last LOCATE command. (See the LOCATE command.)
Note that the standard strings stored in function key F8 combines
a CONTINUE and an EDIT command. Once a LOCATE has been executed
(function key F8), each additional matching record can be edited by
pressing F8.
Example:
1>LOCATE FOR name<'S'
1>EDIT
1>CONTINUE
CONTINUE VPI1 VPI VPIN CONTINUE
VP-Info Level 1 Reference Manual Page 181 SECTION 4
COPY
Copy selected records of the selected file into a new file.
╔════════════════════════════════════════════════════════════════════╗
║ COPY [<scope>] TO <file> [FIELDS <field list> [FOR <cond>] [SDF/ ║
║ SDF DELIMITED [WITH <char>]] ║
║ ║
║ <file> is the name of the file the records are copied to ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ <scope> select records by scope ║
║ (default scope: ALL) ║
║ FIELDS <field list> copy only selected fields ║
║ FOR <cond> select records by condition ║
║ SDF copy into sequential file ║
║ SDF DELIMITED separate fields by commas ║
║ SDF DELIMITED [WITH <char>] separate fields by specified character ║
╚════════════════════════════════════════════════════════════════════╝
The command COPY is used for moving records from the selected
file to a new file, <file>; if a file by the name <file> already
exists, it will be overwritten.
If the SDF option is not used, the result will be a data file
with the default extension DBF and the same structure as the source
file, unless the FIELDS keyword is used with a fields list.
When the SDF option is used, the result is a text file, with the
default extension TXT. When the DELIMITED keyword is not used, each
record (or its selected fields) becomes one line in a sequential file;
the fields are all merged.
With the SDF DELIMITED option, the fields are separated by
commas, and strings are enclosed in single quotes ('). A different
string delimiter can be specified with the WITH clause: example WITH
|. The specified delimiter character is not enclosed in quotes.
For a discussion of the SDF option, see the command APPEND FROM.
Examples:
COPY VPI1 VPI VPIN COPY
VP-Info Level 1 Reference Manual Page 182 SECTION 4
1>USE employee
1>COPY TO empl1
6 COPY(S)
1>USE empl1
1>DELETE 5
1 DELETE(S)
1>COPY TO empl3
5 COPY(S) note: deleted records are not copied
1>RECALL ALL
1>COPY TO empl4 FOR salary <25000 .AND. year_emp>1980
1 COPY(S)
1>COPY TO empl4 FOR salary <25000 SDF DELIMITED WITH |
1 COPY(S)
The result of the last command is a sequential file EMPL4.TXT
with one line as follows:
|Marek|,|Mark|,|231R|,|Broomsdale|,|MD|,|02110|,|566-7012|,|y|,
|11500|,|1984|,|Maintenance|
1>COPY TO empl5 FOR salary <25000 FIELDS name,fname SDF DELIMITED WITH |
1 COPY(S)
The result of the last command is a sequential file EMPL5.TXT
with one line as follows:
|Marek|,|Mark|
COPY VPI1 VPI VPIN COPY
VP-Info Level 1 Reference Manual Page 183 SECTION 4
COPY STRUCTURE
Create a new file with the structure of the selected file.
╔════════════════════════════════════════════════════════════════════╗
║ COPY STRUCTURE TO <file> [FIELDS <field list>] ║
║ ║
║ <file> the name of the new file ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ FIELDS <field list> copy only these fields ║
╚════════════════════════════════════════════════════════════════════╝
The command COPY STRUCTURE creates a new data file with the same
fields as the selected file, but with no records. The default
extension is DBF.
If the FIELDS option is used, the new structure will contain only
the fields listed.
Example:
1>USE employee
1>COPY STRUCTURE TO emp1
1>COPY STRUCTURE TO emp2 FIELDS name,fname,salary,married
1>USE empl2
1>LIST STRUCTURE
Data file: EMPL2.DBF
Number of records: 0
File number: 1
Field Name Type Width Dec
1 NAME C 15
2 FNAME C 10
3 SALARY N 9 2
4 MARRIED L 1
** Record Length ** 36
COPY STRUCTURE VPI1 VPI VPIN COPY STRUCTURE
VP-Info Level 1 Reference Manual Page 184 SECTION 4
COUNT
Count selected records.
╔════════════════════════════════════════════════════════════════════╗
║ COUNT [<scope>] [TO <memvar>] [FOR <cond>] ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ <scope> select by scope (default scope: ALL) ║
║ TO <memvar> store result in memory variable ║
║ FOR <cond> select by condition ║
╚════════════════════════════════════════════════════════════════════╝
This command counts the number of records that meet the selection
criteria. Selection is by scope and/or by condition. The result may
be stored in a numeric memory variable; if the variable does not
exist, this command creates it.
<memvar> cannot be a numeric matrix variable.
The result of the command COUNT is displayed if SET TALK ON, as
in the examples below.
Examples:
1>USE employee
1>COUNT
6 COUNT(S)
1>GO TOP
1>COUNT NEXT 3 FOR name < 'O'
2 COUNT(S)
1>GO TOP
1>COUNT FOR salary < 50000 TO raise
1>? raise
5.00
COUNT VPI1 VPI VPIN COUNT
VP-Info Level 1 Reference Manual Page 185 SECTION 4
CREATE
Create a new data file.
╔════════════════════════════════════════════════════════════════════╗
║ CREATE <file> ║
║ ║
║ <file> the data file to create ║
╚════════════════════════════════════════════════════════════════════╝
The command CREATE is used to make a new data file, <file>;
<file> cannot be a macro. (Do not use COMP for the first four letters
of a data or index file; VP-Info Level 1 is unable to open such a
file.)
File creation is a special form of full-screen editing. Each
field in the data file is represented by four editing fields.
Editing keys:
<Left> or Ctrl-S moves the cursor back one character
<Right> or Ctrl-D moves the cursor forward one character
Ctrl-<Left> moves to the beginning of the editing field
Ctrl-<Right> moves to the end of the editing field
<Ins> or Ctrl-V puts you in insert mode: what you type gets
inserted (normally, you are in overtype mode:
what you type overtypes the existing text);
pressing <Ins> or Ctrl-V again, puts you back
into overtype mode
<BACKSPACE> deletes the character to the left of the cursor
<Del> or Ctrl-G deletes the character on the cursor
Ctrl-Y deletes the rest of the editing field
<Up> or Ctrl-E moves the cursor to the previous editing field
<Dn> or Ctrl-X moves the cursor to the next editing field
Ctrl-Q quits and does not create the file
<End> or Ctrl-W quits and creates the file
Ctrl-K moves back to the top of the previous page
Ctrl-L moves to the top of the next page
Ctrl-N inserts a line for a new field
Ctrl-T deletes the line describing a field
VP-Info Level 1 supports four separate type of data files as
follows:
CREATE VPI1 VPI VPIN CREATE
VP-Info Level 1 Reference Manual Page 186 SECTION 4
Type 0 - Compatible with VP-Info Professional files. Type 0
files can have up to 256 fields in Level 1 and up to 500
fields in VP-Info Professional. Although VP-Info Level 1
can handle only 65,535 records, Type 0 files can hold up to
4 billion records in VP-Info Professional.
Type 1 - Compatible with VP-Info and MAX Type I files. (MAX is
an earlier versions of VP-Info and VP-Info Professional,
also created by Sub Rosa.) Type I files can have up to
256 fields in Level 1 and up to 500 fields in VP-Info
Professional. Maximum of 65,636 records in all versions.
Type 2 - Compatible with dBASE II data files, and are limited to
32 fields. Maximum of 65,636 records in all versions.
Type 3 - Compatible with dBASE III, dBASE III+ and dBASE IV data
files. Type III files can have up to 256 fields in Level 1
and up to 500 fields in VP-Info Professional, although dBASE
III and dBASE III+ cannot read a data file with more than
128 fields, and dBASE IV cannot read a data file with more
than 255 fields. Although VP-Info Level 1 can handle only
65,535 records, Type 3 files can hold up to 2 billion records
in VP-Info Professional.
When all the fields are specified using the full-screen input
display of the CREATE command, the user is asked to specify which type
of file to create; the default is Type 3.
If the data file already exists, you will be given the
opportunity to delete it. On a network with SET NETWORK ON in VP-Info
Professional Network Edition, attempting to delete a data file while
another user is accessing a file with the same name will cause a LOCK
error.
Example:
1>CREATE custfile
shows the following screen after all the fields have been entered:
CREATE VPI1 VPI VPIN CREATE
VP-Info Level 1 Reference Manual Page 187 SECTION 4
──────────────────────────────────────────────────────────────────────────────
Sunday, August 12, 1990
VP-Info CUSTFILE.DBF
Name Type Width Dec Name Type Width Dec
CUSTNUM C 6 0 BIRTHDAY C 6 0
FIRSTNAME C 15 0 SS_NUM C 9 0
LASTNAME C 20 0 EMPL_NUM C 6 0
ADDRESS C 25 0
CITY C 15 0
STATE C 2 0
ZIP C 9 0
HPHONE C 10 0
WPHONE C 10 0
SPOUSEFNAM C 15 0
SPOUSENAME C 20 0
DEPENDENTS N 2 0
┌────────────────────────────────────────────────────────────────────────────┐
│ UP/DOWN COLUMN MOVE ROW SAVE STRUCTURE C..Strings │
│ previous. <PgUp> left... ^K insert... ^N update... <End> N..Numbers │
│ next..... <PgDn> right.. ^L delete... ^T nochange. ^Q L..Yes/No │
└────────────────────────────────────────────────────────────────────────────┘
──────────────────────────────────────────────────────────────────────────────
There are up to 12 fields described in each column, with four
editing windows per field. All the standard full-screen editing keys
are available in CREATE, including Ctrl-K and Ctrl-L to move from
column to column.
As in BROWSE, <Pg Up> and <Pg Dn> are used to move from line to
line, while <Up> and <Dn> are used to move between editing windows on
the same line.
Error checking is done by VP-Info Level 1 as you enter the
specifications for the new fields when you leave a line. Here are
some of the messages you may see:
The first character of a field name must be a letter.
Invalid character in the Name field.
Name fields must be unique.
Types: C-character N-numeric L-logical D-date F-float M-memo.
Field Length must be greater than 0.
Length of character field can not exceed 254.
Length of numeric field can not exceed 20.
Decimals cannot exceed 6.
Decimals too large for length.
CREATE VPI1 VPI VPIN CREATE
VP-Info Level 1 Reference Manual Page 188 SECTION 4
Caution for VP-Info Professional users: Be sure you have set
FIELDS= in the VPI.SET or VPIN.SET file to a number large enough
to accommodate all the fields in all the data files you will ever
have open at one time, plus the largest number of fields in any
of these files. Default is 320 fields. See FIELDS=.
CREATE VPI1 VPI VPIN CREATE
VP-Info Level 1 Reference Manual Page 189 SECTION 4
CURSOR
Move the cursor to a given screen position.
╔════════════════════════════════════════════════════════════════════╗
║ CURSOR <row>,<col> ║
╚════════════════════════════════════════════════════════════════════╝
CURSOR moves the current cursor position to a given point on the
screen. Combined with the ?? command, it gives the user all the
absolute positioning control of the @ SAY command without its
restrictions.
CURSOR is usually employed when the MENU( function is used, to
place the selection bar correctly.
CURSOR VPI1 VPI VPIN CURSOR VP-Info Level 1 Reference Manual Page 190 SECTION 4
DEBUG
Print expression or expression list for debugging purposes.
╔════════════════════════════════════════════════════════════════════╗
║ DEBUG <exp list> ║
║ ║
║ <exp list> the expressions to be displayed ║
╚════════════════════════════════════════════════════════════════════╝
This command displays the expressions exactly as does the ?
command. However, if SET DEBUG OFF, the expressions are not
displayed. This may save the programmer the trouble of having to
place the DEBUG commands in the program when debugging, and having to
take them out for the regular running of the program.
See SET DEBUG.
Examples (in a program):
DEBUG number
DEBUG 'current amount: ', amount, ' current balance: ', balance
DEBUG VPI1 VPI VPIN DEBUG VP-Info Level 1 Reference Manual Page 191 SECTION 4
DELAY
Suspend execution for a specified number of seconds.
╔════════════════════════════════════════════════════════════════════╗
║ DELAY <num exp> ║
║ ║
║ <num exp> the number of seconds execution is to be delayed ║
╚════════════════════════════════════════════════════════════════════╝
This command suspends program execution for a specified number of
seconds.
The delay can be any length from .06 seconds upward. For
programmers, this command can replace complex loops which often have
the deficiency of varying in length depending on what type of computer
the program is run on.
Example:
1>DELAY .5
1>number=3
1>DELAY number
DELAY VPI1 VPI VPIN DELAY VP-Info Level 1 Reference Manual Page 192 SECTION 4
DELETE
Delete selected records from the selected data file.
╔════════════════════════════════════════════════════════════════════╗
║ DELETE [<scope>] [FOR <cond>] ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ <scope> select by scope (default scope: current record) ║
║ FOR <cond> select by condition ║
╚════════════════════════════════════════════════════════════════════╝
The DELETE command is used to set the DELETED flag for records in
the selected data file.
These records can be recovered by the RECALL command or with
Ctrl-U in the BROWSE and EDIT commands, provided SET DELETE is OFF.
Deleted records are not "seen" by certain VP-Info Level 1
commands irrespective of SET DELETE status, including: COPY, POST,
UPDATE, SUM, AVERAGE, COUNT.
To remove all the records with the deleted flag set, use the PACK
command. (See the commands: SET DELETE, RECALL, PACK.)
Examples:
1>USE employee
1>COPY TO empl1
6 COPY(S)
1>USE#3 empl1
1>DELETE RECORD 2
1 DELETE(S)
1>DELETE#3 RECORD 5
1 DELETE(S)
1>SKIP
1>DELETE NEXT 3 FOR salary < 25000
1 DELETE(S)
1>PACK#3
5 TOTAL PACKED
1>PACK
4 TOTAL PACKED
DELETE VPI1 VPI VPIN DELETE VP-Info Level 1 Reference Manual Page 193 SECTION 4
DELETE FILE
Remove files from disk.
╔════════════════════════════════════════════════════════════════════╗
║ DELETE FILE <file> ║
║ ║
║ <file> the name of the file to be deleted ║
╚════════════════════════════════════════════════════════════════════╝
The DELETE FILE command deletes a file from the disk. This
command should be used with care because, once deleted, the file
cannot be recovered. If no extension is given, the extension DBF is
assumed. Wildcards are not permitted.
On a network with SET NETWORK ON in VP-Info Professional Network
Edition, attempting to delete a file while another user is accessing
it will cause a LOCK error.
Examples:
1>DIR c*.dbf
CCUST.DBF 522 10-13-88 5:42p COMMS.DBF 6546 1-06-90 5:11p
COMMS2.DBF 6342 1-07-90 1:00p CUSTJUNK.DBF 7062 9-17-89 3:57p
CUSTOMER.DBF 734 11-29-89 10:43p CUST2.DBF 734 3-19-90 7:03p
21940 bytes in 6 files.
5246976 bytes remaining.
1>DELETE FILE cust2
1>DIR c*.dbf
CCUST.DBF 522 10-13-88 5:42p COMMS.DBF 6546 1-06-90 5:11p
COMMS2.DBF 6342 1-07-90 1:00p CUSTJUNK.DBF 7062 9-17-89 3:57p
CUSTOMER.DBF 734 11-29-89 10:43p
21206 bytes in 5 files.
5251072 bytes remaining.
734 characters were copied.
DELETE FILE VPI1 VPI VPIN DELETE FILE VP-Info Level 1 Reference Manual Page 194 SECTION 4
DIM
Define a memory variable as a matrix.
╔════════════════════════════════════════════════════════════════════╗
║ DIM CHAR [<width>] <memvar>[x1,x2,x3],<memvar2>[y1,y2,y3],... ║
║ DIM NUM <memvar>[x1,x2,x3],<memvar2>[y1,y2,y3],... ║
║ DIM LOG <memvar>[x1,x2,x3],<memvar2>[y1,y2,y3],... ║
║ ║
║ <memvar>, <memvar2> the names of the memory variables that ║
║ are defined as matrices ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ <width> the width of the character variables ║
╚════════════════════════════════════════════════════════════════════╝
Matrices of up to 3 dimensions can be defined for each of the
three data types (CHARACTER, NUMERIC, LOGICAL). The width of the
entries of CHAR matrices is fixed; it is 10 if not specified by the
user.
Note that in the syntax description of DIM, [x1,x2,x3] does not
indicate an option. [ and ] must be present in a DIM command. x1,
x2, x3 are integer numbers greater than zero, not variables, up to
three in number.
Examples:
One dimensional matrices (also called vectors):
DIM CHAR a[12]
DIM CHAR 20 a[12]
DIM CHAR a[12],b[12]
DIM NUM a[21]
DIM LOG a[20]
Two dimensional matrices (also called tables):
DIM CHAR 25 first[10,20]
DIM NUM second[5,20]
Three dimensional matrixes:
DIM CHAR 10 a[10,10,10]
DIM NUM b[5,5,50]
A mixed definition:
DIM CHAR 12 a[50],b[2,2,12]
Note that the width of both A and B is 12.
DIM VPI1 VPI VPIN DIM VP-Info Level 1 Reference Manual Page 195 SECTION 4
Matrix variables can be used just like all other memory variables
except that only = and STORE can assign values to them. Commands and
functions that create memory variables (such as the command COUNT) or
store values in existing memory variables (such as the command READ or
the function READ() cannot directly use matrix variables. Matrix
variables cannot be used in a TEXT structure or TEXT file.
Matrix variables are stored in high memory (see Section A). The
size of a matrix is at most 64K. Use the STATUS command to find out
how much high memory is available. Numeric variables take 8 bytes and
logical variables take 2 bytes of memory for each entry.
Notes: The numbering is from 1. Matrices can be redimensioned in
a program. No part of a DIM command can be a macro.
Examples:
Memory use (in bytes)
1>DIM CHAR 25 name[40] 1,000
1>DIM CHAR fill[10,7] 700
1>DIM NUM b[2,3],total[10,20,5] 48 and 8000
1>DIM LOG abc[5000] 10,000
1>? name[14]
GEORGE
1>c=300
1>? abc[c]
F
1>total[4,15,3]=total[3,15,3]*563.123
1>DIM NUM money[10]
1>USE employee
1>SUM salary TO temp
1>money[1]=temp
The effect of SET WIDTH TO on displaying matrix variables:
1>DIM NUM num[20]
1>? num
0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
1>SET WIDTH TO 30
1>? num
0.00 0.00 0.00
0.00 0.00 0.00
0.00 0.00 0.00
0.00 0.00 0.00
0.00 0.00 0.00
0.00 0.00 0.00
0.00 0.00
DIM VPI1 VPI VPIN DIM VP-Info Level 1 Reference Manual Page 196 SECTION 4
DIR
Directory listing.
╔════════════════════════════════════════════════════════════════════╗
║ DIR [<pathname>][<file specification>] ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ <pathname> DOS directory name, with optional drive ║
║ letter and colon ║
║ <file specification> a file name, with optional DOS windcards; ║
║ extension is required if present ║
╚════════════════════════════════════════════════════════════════════╝
This command is similar to the DIR command of the DOS operating
system: it displays the list of files on the current disk, together
with file size and date and time created or last modified. Total size
of all matching files is also given along with the bytes remaining on
the disk.
If a file name is given in full, the directory will show only
that one file.
A partial listing of the directory can be specified by giving a
<file specification> with wild card characters.
The wild card character ? may be replaced by any single
character; the wild card character * allows any string.
Examples:
1>DIR
SEN_NAME.NDX 1024 10-24-89 1:07a SEN_NUM.NDX 1024 10-24-89 1:07a
SEN_REIN.PRG 757 8-31-89 11:30p SEN_SYST.DBF 53 9-06-89 9:02a
SEN_ZIP.NDX 1024 10-24-89 1:07a SUBDUE.ARC 342658 11-29-89 8:25p
SUBDUE.PRG 2027 11-29-89 7:21p SUBDUE2.PRG 1168 11-29-89 2:29a
349735 bytes in 8 files.
5251072 bytes remaining.
1>dir \*.
LIB <DIR> 8-04-89 2:42p MAX <DIR> 8-04-89 1:27p
RELTEST <DIR> 8-06-89 10:27a SILVERAD <DIR> 8-07-89 2:32p
SUPER <DIR> 8-27-89 8:30p TMP <DIR> 8-04-89 1:28p
V14 <DIR> 8-23-89 9:22p VAWORK <DIR> 8-04-89 12:09p
MANUAL <DIR> 10-30-89 10:53a GEN <DIR> 11-08-89 12:00a
0 bytes in 10 files.
5251072 bytes remaining.
DIR VPI1 VPI VPIN DIR VP-Info Level 1 Reference Manual Page 197 SECTION 4
1>DIR c*.dbf
CCUST.DBF 522 10-13-88 5:42p COMMS.DBF 6546 1-06-90 5:11p
COMMS2.DBF 6342 1-07-90 1:00p CUSTJUNK.DBF 7062 9-17-89 3:57p
CUSTOMER.DBF 734 11-29-89 10:43p
21206 bytes in 5 files.
5251072 bytes remaining.
DIR VPI1 VPI VPIN DIR
VP-Info Level 1 Reference Manual Page 198 SECTION 4
DIRF
Directory listing, following redirection commands of the current FILES
structure.
╔════════════════════════════════════════════════════════════════════╗
║ DIRF [<file specification>] ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ <file specification> a file name, with optional DOS windcards; ║
║ extension is required if present ║
╚════════════════════════════════════════════════════════════════════╝
VP-Info Level 1 provides for a FILES structure (see FILES) which
lets you specify default drive letters and/or directories for the
various files used by the programs. Usually file types are grouped
into individual directories according to "skeletons" constructed with
wildcards. For example:
FILES
*.dbf,\data\
*.cpl,\cpl\
*.ndx,\indexes\
ENDFILES
The DIRF command is similar to the DIR command, except that the
file specification is compared to the existing FILES structure and, if
a match is made, the redirection in the structure is applied to the
file specification, so that the directory displayed is of the
redirected directory, not the current directory.
It displays a list of all matching files in that directory,
together with file size and date and time created or last modified.
Total size of all matching files is also given along with the bytes
remaining on the current disk.
If a file name is given in full, the directory will show only
that one file. The wild card character ? may be replaced by any
single character; the wild card character * allows any string.
Examples:
1>DIRF *.dbf
CCUST.DBF 522 10-13-88 5:42p COMMS.DBF 6546 1-06-90 5:11p
COMMS2.DBF 6342 1-07-90 1:00p CUSTJUNK.DBF 7062 9-17-89 3:57p
CUSTOMER.DBF 734 11-29-89 10:43p
21206 bytes in 5 files.
5251072 bytes remaining.
FIRF VPI1 VPI VPIN DIRF VP-Info Level 1 Reference Manual Page 199 SECTION 4
DISPLAY
Display information, memory variables, system variables, file
structure.
╔════════════════════════════════════════════════════════════════════╗
║ DISPLAY [<scope>] [FOR <cond>] [<exp list>] [OFF] ║
║ DISPLAY FILES [LIKE <skeleton>] [ON <drive letter>] ║
║ DISPLAY MEMORY ║
║ DISPLAY STRUCTURE ║
║ DISPLAY SYSTEM ║
╟────────────────────────────────────────────────────────────────────╢
║ Options (for displaying data file records): ║
║ ║
║ <scope> select by scope (default: the current record) ║
║ FOR <cond> select by condition ║
║ OFF do not display the record number ║
╟────────────────────────────────────────────────────────────────────╢
║ Options (for listing directories): ║
║ ║
║ LIKE <skeleton> the file specification, with optional wildcards ║
║ ON <drive letter> a drive designation, with optional colon ║
╚════════════════════════════════════════════════════════════════════╝
These commands are exactly the same as the LIST commands except
for the following differences: the default scope of the DISPLAY
command is the current record rather than the whole file; the listing
is stopped at the bottom of the screen or current window (about every
20 lines when displaying data file contents).
See the commands: LIST, LIST FILES, LIST MEMORY, LIST STRUCTURE,
and LIST SYSTEM.
DISPLAY VPI1 VPI VPIN DISPLAY VP-Info Level 1 Reference Manual Page 200 SECTION 4
DO
In a program, execute a subroutine and, on completion, return to the
next command in the calling program; in Conversational
VP-Info Level 1, equivalent to CHAIN.
╔════════════════════════════════════════════════════════════════════╗
║ DO <file> ║
║ ║
║ <file> the name of the program called ║
╚════════════════════════════════════════════════════════════════════╝
In Conversational VP-Info Level 1, DO is the same as CHAIN: it
begins the execution of the compiled program with the name <file> with
extension CPL; otherwise, the uncompiled VP-Info Level 1 program
<file> will be compiled "on the fly" and executed, and the compiled
file immediately deleted from the disk.
Note that an uncompiled program with a GLOBAL statement cannot be
compiled on the fly if it needs to import variable values, since
compile step includes a CLEAR command.
In a program, the command DO <file> causes the program <file> to
be compiled as a subroutine of the current program. No matter how
many subroutines are called, all will be compiled into the same CPL
file as the calling program. The subroutines become overlays; they
are called into memory when needed.
When the called program executes a RETURN command, the execution
resumes in the current program with the line following the DO command.
The called program can itself DO other subroutines. There can be
subroutines up to 10 levels.
When a subroutine is compiled, all information about data files
and memory variables is coded in the compiled form: the environment is
compiled with the subroutine. Contrast this with the CHAIN command
that starts with a clean slate.
Any time a subroutine is invoked with a DO, the called program
becomes an overlay. If a subroutine is called 5 times, it is compiled
5 times. This, of course, would make for very bulky programs.
The solution of this problem is very simple. If the subroutine
TEST is not sensitive to the environment (it does not use any fields
or memory variables, or all data files and memory variable names are
the same throughout the calling program), DO it as follows:
...
PERFORM STEST
...
PERFORM STEST
DO VPI1 VPI VPIN DO VP-Info Level 1 Reference Manual Page 201 SECTION 4
...
*
PROCEDURE STEST
DO TEST
ENDPROCEDURE
This way, TEST becomes a single overlay; it is invoked with PERFORM
STEST.
Note: If the same subroutine is called from two places in the
same program, but the two places have different environments, the
subroutine cannot be called from a single procedure, and has to be
compiled twice.
For example, assume that TEST carries out some computation on
some fields of the data file HISTORY1 and some memory variables, and
then carries out the same computations on some fields of the data file
HISTORY2 and some memory variables; HISTORY1 is file 2, while
HISTORY2 is file 3.
Create two procedures:
PROCEDURE TEST1
SELECT 2
DO TEST
ENDPROCEDURE
*
PROCEDURE TEST2
SELECT 3
DO TEST
ENDPROCEDURE
Now if you need to invoke TEST with the first environment
(HISTORY1), then PERFORM TEST1; otherwise, PERFORM TEST2.
All procedures called by a subroutine must be contained in the
PRG file of the subroutine. A procedure of the calling program cannot
have the same name as a procedure of the subroutine. It is good
programming practice not to have the same name for procedures and
subroutines.
Procedures are internally compiled, while subroutines become
overlays. Therefore, procedures are faster in execution. However,
there is a limit of 32 procedures in total for one CPL file. See
CHAIN and PERFORM.
The name of the PRG file used with the DO command cannot be a
macro.
Example in Conversational VP-Info Level 1:
DO INVOICE
DO VPI1 VPI VPIN DO VP-Info Level 1 Reference Manual Page 202 SECTION 4
This will execute INVOICE.CPL if present; otherwise it will
compile and execute INVOICE.PRG, and then delete the CPL file.
DO VPI1 VPI VPIN DO VP-Info Level 1 Reference Manual Page 203 SECTION 4
DO CASE
Switch the program flow to a number of cases.
╔════════════════════════════════════════════════════════════════════╗
║ DO CASE ║
╚════════════════════════════════════════════════════════════════════╝
The command DO CASE provides for the processing of a number of
options without the use of nested IF commands. It is used in
conjunction with the CASE, OTHERWISE, and ENDCASE commands.
The DO CASE program structure is as follows:
DO CASE
CASE <cond1>
<program segment1>
CASE <cond2>
<program segment2>
...
CASE <condn>
<program segmentn>
OTHERWISE
<program segment>
ENDCASE
where <cond1>, <cond2>, <cond3>,..., <condn> are conditions, <program
segment1>, <program segment2>,..., <program segmentn> and <program
segment> are program segments, that is, any number of VP-Info Level 1
program lines.
Execution is as follows:
After the DO CASE is encountered, VP-Info Level 1 looks for the
first CASE command and evaluates the condition; if the condition is
true, the following program segment is executed, terminated by the
next CASE, by OTHERWISE, or by ENDCASE. After the execution of the
program segment, the program execution continues with the program line
after the ENDCASE command.
If the condition is false, VP-Info Level 1 looks for the next
CASE command. If no condition is true, VP-Info Level 1 executes the
program segment following the OTHERWISE command (if any).
The OTHERWISE command is optional. Note that if more than one
condition holds, only the segment after the first true condition is
executed.
DO case commands can be nested up to 10 levels.
Example:
DO CASE VPI1 VPI VPIN DO CASE VP-Info Level 1 Reference Manual Page 204 SECTION 4
ans2='P'
@ 22,10 SAY 'E-edit A-add O-order L-look Q-quit ' GET ans2
READ
@ 22,10
DO CASE
CASE UPPER(ans2)='Q'
picked=f
ok=f
LOOP
CASE UPPER(ans2)='E'
@ y,3 GET style
@ y,10 GET color
@ y,14 GET descript
@ y,35 GET q1
@ y,39 GET q2
@ y,43 GET q3
@ y,47 GET q4
@ y,51 GET q5
@ y,55 GET q6
@ y,59 GET q7
@ y,63 GET q8
READ
IF q1+q2+q3+q4+q5+q6+q7+q8=0
DELETE
ENDIF
mpick=t
CASE UPPER(ans2)='O'
REPLACE type WITH 'O'
...
OTHERWISE
IF type='P'
REPLACE type WITH 'O'
ENDIF
picked=f
ENDCASE
When editing with the internal VP-Info Level 1 programming editor
(see WRITE command), Alt-F reformats the file with all structures
properly indented, making it easy to see unbalanced structures.
DO CASE VPI1 VPI VPIN DO CASE VP-Info Level 1 Reference Manual Page 205 SECTION 4
DO WHILE
The standard program loop command.
╔════════════════════════════════════════════════════════════════════╗
║ DO WHILE <cond> ║
║ ║
║ <cond> the condition controlling the loop ║
╚════════════════════════════════════════════════════════════════════╝
The command DO WHILE starts the program loop. The structure of
the loop is as follows:
DO WHILE <cond>
<program segment>
ENDDO
Execution is as follows:
After the DO WHILE is encountered, <cond> is evaluated. If
<cond> is true, the VP-Info Level 1 program segment (terminated by the
ENDDO) is executed; then <cond> is evaluated again. If <cond> is
false, execution continues with the command following ENDDO.
There can be a DO WHILE command within a DO WHILE command; this
is called nesting. Many level of nesting is permitted; however, too
many levels of nesting will give a compile-time error message: Stack
overflow.
There are two commands that facilitate moving to the top and the
bottom of the loop: LOOP moves the execution to the top of the loop,
and BREAK exits the loop.
There is one more looping command in VP-Info Level 1: REPEAT.
(See the commands BREAK, LOOP, REPEAT.)
Examples:
1. Typical DO WHILE to process all the records of a file:
USE employee
ERASE
DO WHILE .NOT. EOF
? name, fname, tel_no
SKIP
ENDDO
2. Typical DO WHILE for counting how many records to list:
count=0
USE records
DO WHILE count<100
DO WHILE VPI1 VPI VPIN DO WHILE VP-Info Level 1 Reference Manual Page 206 SECTION 4
? invoice_no,amount*qty
SKIP
count=count+1
ENDDO
When editing with the internal VP-Info Level 1 programming editor
(see WRITE command), Alt-F reformats the file with all structures
properly indented, making it easy to see unbalanced structures.
DO WHILE VPI1 VPI VPIN DO WHILE VP-Info Level 1 Reference Manual Page 207 SECTION 4
EDIT
Edit records in a data file.
╔════════════════════════════════════════════════════════════════════╗
║ EDIT [<recnum>] [FIELDS <field list> / OFF / TEXT <textfile>] ║
╟────────────────────────────────────────────────────────────────────╢
║ Options ║
║ ║
║ <recnum> begin EDIT on record number <recnum> ║
║ FIELDS <field list> the fields to be edited ║
║ TEXT <textfile> erases the screen, displays the text file, ║
║ and then does EDIT using the text file ║
║ layout and embedded format pictures ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ OFF rather than generate an EDIT input screen, ║
║ uses an exiting screen and its Get Table ║
╚════════════════════════════════════════════════════════════════════╝
The EDIT command without either the OFF or TEXT option allows the
user to view and modify records in the selected file. Once the
command is given, the screen shows the current record (or the record
optionally specified with <recnum>) in full-screen editing mode.
If the FIELDS keyword and a fields list is specified, only those
fields will be available during EDIT; otherwise, VP-Info Level 1
builds an input screen using all fields in the current data file.
To exit from EDIT, use <End> (or Ctrl-W) once you have filled in
the fields of the last record desired. To switch from EDIT to APPEND
mode, press Ctrl-<PgDn>, while <PgUp> switches back from APPEND into
EDIT mode.
Note that APPEND is actually a special mode of EDIT; the only
difference is that EDIT begins by displaying the current record, while
APPEND adds a new blank record to the data file and displays that. All
the editing fields are the same for both EDIT and APPEND.
EDIT updates all index files in use.
The command SET MENU ON displays the most important editing keys
at the top of the screen, except if OFF or TEXT keyword is used, or if
the current window is less than 80 characters wide or 10 rows deep.
Editing keys:
<Left> or Ctrl-S moves the cursor back one character
<Right> or Ctrl-D moves the cursor forward one character
Ctrl-<Left> moves to the beginning of the field
Ctrl-<Right> moves to the end of the field
EDIT VPI1 VPI VPIN EDIT VP-Info Level 1 Reference Manual Page 208 SECTION 4
<Ins> or Ctrl-V puts you in insert mode: what you type gets
inserted (normally, you are in overtype
mode: what you type overtypes the existing
text); pressing <Ins> or Ctrl-V again, puts
you back into overtype mode
<BACKSPACE> deletes the character to the left of the
cursor
<Del> or Ctrl-G deletes the character on the cursor
Ctrl-Y deletes the rest of the field
<Up> or Ctrl-E moves the cursor to the previous field
<Dn> or Ctrl-X moves the cursor to the next field
Ctrl-Q quits and does not update the current record
<End> or Ctrl-W quits and updates the current record
<PgUp> or Ctrl-R edits the previous record; if in APPEND mode,
exits to EDIT mode
<PgDn> or Ctrl-C edits the next record
Ctrl-<Pg Dn> Enters APPEND mode; adds a blank record and
places the cursor in that new record
Ctrl-K moves back to the top of the previous page
(not with OFF or TEXT keywords)
Ctrl-L moves to the top of the next page (not with
OFF or TEXT keywords)
Alt-W when the cursor is in a memo field, edit the
current memo (if no current memo, one is
created) and allow changes to be saved
Alt-R when the cursor is in a memo field, view the
current memo in read-only mode; no changes
are saved
Examples:
1>USE employee
1>GO 2
1>EDIT
1>EDIT 2
You then see:
EDIT VPI1 VPI VPIN EDIT VP-Info Level 1 Reference Manual Page 209 SECTION 4
─────────────────────────────────────────────────────────────────────────────
#1 EMPLOYEE.DBF EDIT Record 2
Page 1
┌────────────────────────────────────────────────────────────────────────────┐
│REC: prev <PgUp> next <PgDn> delete ^U PAGE: prev ^K next ^L │
│FILE: top ^<Home> bottom ^<End> DELETE: char <Del> to end of field ^Y │
│APPEND MODE: begin ^<PgDn> exit <PgUp> EXIT: with save <End> no save ^Q │
└────────────────────────────────────────────────────────────────────────────┘
NAME........... Steiner
FNAME.......... Tom
ADDR........... 114 North Pitt St.
CITY........... Lakewood
STATE.......... MD
ZIP............ 02111
TEL_NO......... 596-0017
MARRIED........ y
SALARY......... 35780.00
YEAR_EMP....... 1984
DEPT........... Engineering
─────────────────────────────────────────────────────────────────────────────
To edit only a few fields:
1>USE employee
1>SET MENU ON
1>EDIT FIELDS name, fname, tel_no
This displays:
─────────────────────────────────────────────────────────────────────────────
#1 EMPLOYEE.DBF EDIT Record 7
Page 1
┌────────────────────────────────────────────────────────────────────────────┐
│REC: prev <PgUp> next <PgDn> delete ^U PAGE: prev ^K next ^L │
│FILE: top ^<Home> bottom ^<End> DELETE: char <Del> to end of field ^Y │
│APPEND MODE: begin ^<PgDn> exit <PgUp> EXIT: with save <End> no save ^Q │
└────────────────────────────────────────────────────────────────────────────┘
NAME........... Marek
FNAME.......... Joe
TEL_NO......... 566-7012
─────────────────────────────────────────────────────────────────────────────
The following examples show EDIT using the TEXT and OFF keywords
combined with an external text file (output from both is identical; OFF
allows the added flexibility of using an internal TEXT structure and/or
an ON FIELD structure):
EDIT VPI1 VPI VPIN EDIT VP-Info Level 1 Reference Manual Page 210 SECTION 4
1>USE employee
1>EDIT TEXT employee
1>USE employee
1>TEXT Employee
1>EDIT OFF
These both display:
─────────────────────────────────────────────────────────────────────────────
EDIT Record 23
NAME........... ARTHUR NEUMANN
ADD_1.......... 4274 MATHERS BLVD. E. UPSON DOWNS
ZIP............ 59768
PHONE.......... 243-5548 (614)
WPHONE......... 643-5657 (614)
EXPERIENCE.....
ACCT STUDENT, WORKED FOR CPA SCARECROW & MOSCOWITZ, BOSTON
COMMENTS
KNOWS INCOME-TAX LAW, WITH SPECIALTIES IN DEPRECIATION AND
TAX SHELTERS; SUGGEST ASSIGN TO CENTRAL OFFICE
─────────────────────────────────────────────────────────────────────────────
See the TEXT command for a full discussion of the TEXT command.
The TEXT used for the above input screen:
─────────────────────────────────────────────────────────────────────────────
.. zip,!9! 9!9
.. phone,999-9999 (999)
.. wphone,999-9999 (999)
.. training,99/99
NAME........... %FNAME %NAME
ADD_1.......... %ADD_1 %AREA
ZIP............ @ZIP
PHONE.......... @PHONE
WPHONE......... @WPHONE
EXPERIENCE.....
@EXPERIENCE
COMMENTS
@COMMENT1
@COMMENT2
─────────────────────────────────────────────────────────────────────────────
EDIT VPI1 VPI VPIN EDIT VP-Info Level 1 Reference Manual Page 211 SECTION 4
The following demonstration program illustrates use of EDIT OFF:
────────────────────────────────────────────────────────────────────────────
**********************************************************************
* EDIToff.prg demonstration program for the EDIT OFF command
* Note the technique used to "wrap" the file...when skipping
* past EOF, program "wraps to top of file, and vice versa,
* using new SOUND command to beep (silent if NOEFFECTS in VPI.SET).
* (C) 1990 Sub Rosa Publishing Inc. (Author: Sidney L. Bursten)
**********************************************************************
USE customer
ON escape ;what to do when <Esc> is pressed
WINDOW ;cancel small window
CURSOR 23,0 ;put cursor in bottom left corner of screen
CANCEL ;exit program
ENDON
WINDOW
ERASE
TEXT
┌────────────────────────────────────────────────────────────────────────────┐
│REC: prev <PgUp> next <PgDn> DELETE RECORD ^U │
│FILE: top ^<Home> bottom ^<End> DELETE: char <Del> to end of field ^Y │
│APPEND MODE: begin ^<PgDn> exit <PgUp> EXIT: with save <End> no save ^Q │
└────────────────────────────────────────────────────────────────────────────┘
ENDTEXT
WINDOW 8,10,17,69 double
TEXT
.. custnum,!!!-!-99
.. hphone,999-9999 (999)
.. wphone,999-9999 (999)
.. state,!!
Enter customer data:
Number...... @custnum
Name........ %firstname %lastname
Address..... @address
City, State. %city %state
Zip Code.... @zip
Phones (H/W) %hphone %wphone
ENDTEXT
DO WHILE t
EDIT off ;edit using Get Table created with TEXT above
DO CASE
CASE :key=335 ;exit loop when <End> key pressed
BREAK
CASE eof ;skipped past end of file; start again at top
SOUND 11
GOTO top
CASE #<1 ;backed up past beginning of file; start again at bottom
SOUND 11
GOTO bottom
EDIT VPI1 VPI VPIN EDIT VP-Info Level 1 Reference Manual Page 212 SECTION 4
IF eof ;if no undeleted records left in file, get out
BREAK
ENDIF
ENDCASE
ENDDO
WINDOW ;cancel small window
CURSOR 23,0 ;put cursor in bottom left corner of screen
────────────────────────────────────────────────────────────────────────────
Page 213 intentionally omitted
EDIT VPI1 VPI VPIN EDIT VP-Info Level 1 Reference Manual Page 214 SECTION 4
EJECT
Start a new page on the printer.
╔════════════════════════════════════════════════════════════════════╗
║ EJECT ║
╚════════════════════════════════════════════════════════════════════╝
The EJECT command sends a form feed (eject page, top of form)
signal to the printer.
This also resets the line and column counters to 0 for the
@ commands.
EJECT will attempt to advance the printer whether printing is on
or off. If your printer is on but off-line, your program may appear
to hang; either put the printer on-line, or turn off the printer to
release VP-Info Level 1 to continue processing.
When spooling (see SPOOL), the form-feed is placed into the spool
file, and has no effect on the printer until the file is spooled or
copied to the printer.
(See the commands @, SET FORMAT TO PRINT, SET PRINT ON, SET EJECT
ON/OFF, SET LENGTH TO, and the functions ROW( and COL(.
Examples:
1>EJECT
In a program, EJECT and SPOOL may be used together to reset the
line counter to zero before printing begins:
SPOOL junk
EJECT
SPOOL
EJECT VPI1 VPI VPIN EJECT VP-Info Level 1 Reference Manual Page 215 SECTION 4
ELSE
The optional part of an IF program structure.
╔════════════════════════════════════════════════════════════════════╗
║ ELSE ║
╚════════════════════════════════════════════════════════════════════╝
This command introduces the optional part of the program
structure IF/ENDIF. See the command IF.
Example:
IF count>5
ok=t
ELSE
IF count<2
ok=f
ENDIF
? 'ok'
ENDIF
ELSE VPI1 VPI VPIN ELSE VP-Info Level 1 Reference Manual Page 216 SECTION 4
END commands
Terminate a command structure.
╔════════════════════════════════════════════════════════════════════╗
║ ENDCASE ║
║ ENDDO ║
║ ENDIF ║
║ ENDFILES ║
║ ENDON ║
║ ENDPROCEDURE ║
║ ENDREPEAT ║
║ ENDTEXT ║
╚════════════════════════════════════════════════════════════════════╝
All VP-Info Level 1 structures are terminated with a matching END
command as shown above. When editing with the internal
VP-Info Level 1 programming editor (see WRITE command), Alt-F
reformats the file with all structures properly indented, making it
easy to see unbalanced structures.
See DO CASE, DO WHILE, IF, FILES, ON ERROR, ON ESCAPE, ON FIELD,
PROCEDURE, REPEAT, and TEXT.
END Commands VPI1 VPI VPIN END Commands VP-Info Level 1 Reference Manual Page 217 SECTION 4
ERASE
Erase screen.
╔════════════════════════════════════════════════════════════════════╗
║ ERASE [line1,line2] ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: ║
║ ║
║ line1, line2 erase from line1 to line2 ║
╚════════════════════════════════════════════════════════════════════╝
This command erases the screen, and is a synonym for CLS.
If, optionally, two numeric expressions, line1 and line2, are
given, it erases line1 and line2, and all lines between, if any.
These expressions should have values between 0 and 24.
ERASE is the same as the following three commands:
CLS
ERASE 0,24
CLS 0,24
Examples:
1>ERASE
1>ERASE 2,4
1>ERASE 2,2
ERASE VPI1 VPI VPIN ERASE
VP-Info Level 1 Reference Manual Page 218 SECTION 4
FIELD
Initiates a program segment module in an ON FIELD structure
╔════════════════════════════════════════════════════════════════════╗
║ FIELD <fieldname>/<fieldnum> ║
║ ║
║ fieldname name of a field in a Get Table ║
║ fieldnum number of a field in a Get Table ║
╚════════════════════════════════════════════════════════════════════╝
Each field in a Get Table may have a program segment in a
program's ON FIELD structure which will be executed when the cursor
leaves that field, or optionally when READ or the current record is
exited.
All fields in a Get Table are numbered from 1 to 64 in the order
in which they are placed on the screen. When they are painted by
@ GET commands, the order is the same as the order of the @ GET
commands in the program; if painted by TEXT, the order is left-to-
right on each line, and then top-to-bottom.
When editing with the internal VP-Info Level 1 programming editor
(see WRITE command), Alt-F reformats the file with all structures
properly indented, making it easy to see unbalanced structures.
(See command ON FIELD.)
Examples:
FIELD 3
FIELD cust
FIELD name#3
FIELD VPI1 VPI VPIN FIELD VP-Info Level 1 Reference Manual Page 219 SECTION 4
FIELDS=
Set the maximum number of fields available at any one time.
╔════════════════════════════════════════════════════════════════════╗
║ FIELDS= <num> ║
║ ║
║ VP-Info Professional only VPI.SET file only ║
║ ║
║ <num const> maximum number of fields allowed in all data files ║
║ open at any one time (including VP-Info Level 1's ║
║ internal work file); range 128 to 1000 ║
╚════════════════════════════════════════════════════════════════════╝
This command sets the maximum number of fields that can be open
at any one time in all open files, taking the place of SET FIELDS TO
in earlier versions of the language (now ignored if encountered by the
VPI-Info compiler).
Reserving memory space for a single field requires 16 bytes.
Therefore, increasing the number of fields requested reduces the
memory space available for your program.
The limits for FIELDS= are 128 and 1000, with a default of 320.
Caution: be sure you have SET FIELDS to a number large
enough to accommodate all the fields in all the data files you
will ever have open at one time, plus the largest number of
fields in any of these files.
Example:
FIELDS=500
FIELDS= VPI VPIN FIELDS= VP-Info Level 1 Reference Manual Page 220 SECTION 4
FILES
Lets you specify drive letters, directories, and/or default file modes
for various files used by VP-Info Level 1.
╔════════════════════════════════════════════════════════════════════╗
║ FILES ║
║ FILES <specification> [,[<file direction>] [,<mode>]] ║
║ ║
║ specification any file name or "skeleton" (using the * and ? ║
║ wildcards ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ file direction any legal DOS path, consisting of drive letter ║
║ and colon and/or directory path ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: (VP-Info Professional Network Edition only): ║
║ ║
║ mode any one of the optional file-opening modes used ║
║ in network operation -- LOCK or L, WRITE or W, ║
║ READ or R, or SHARE or S. If no mode is set, ║
║ or if Network Edition is not in use, the ║
║ default mode is LOCK ║
╚════════════════════════════════════════════════════════════════════╝
There is always a FILES Table in memory, set up by the active
FILES ... ENDFILES structure. (This table is empty if there is no
active FILES ... ENDFILES structure.) The FILES command allows
on-the-fly additions and changes to the FILES Table from either
Conversational VP-Info Level 1 or programs.
Examples of Form 1 (Only in programs):
FILES
Initiates a FILES ... ENDFILES structure. (See FILES ... ENDFILES.)
(Only in Conversational VP-Info Level 1)
1>FILES
Empties the current FILES Table in memory. (Caution: Do not confuse
this interactive command with the FILES command as used in programs,
which always initiates a FILES ... ENDFILES structure.)
Examples of Form 2 (In either programs or Conversational
VP-Info Level 1):
FILES *.dbf,c:\data
FILES VPI1 VPI VPIN FILES VP-Info Level 1 Reference Manual Page 221 SECTION 4
Given this command, either in a program or in Conversational
VP-Info Level 1, VP-Info Level 1 searches the FILES Table in memory
for a matching file specification. If the file specification *.DBF is
found, the new path will replace the existing path; otherwise, this
specification and redirection is added to the top of the FILES Table.
FILES *.frm
If no <file direction> is specified, file redirection is turned off
for files matching this entry.
Macros are allowed with the FILES command itself, either in
programs or in Conversational VP-Info Level 1, although macros are not
permitted in the FILES ... ENDFILES structure.
For VP-Info Professional Network Edition only
There is a special form of the FILES command which has
significance only in VP-Info Professional Network Edition with SET
NETWORK ON.
This form adds a <mode> which sets the default file mode for all
matching files. For example,
FILES *.ndx,ndx,READ
sets a file mode of READ for all files with an NDX extension, all of
which are found in the NDX subdirectory of the current directory.
If only <specification> and <mode> are given, the file mode is
given to all files matching that specification wherever they are on
the disk. (Note: two commas are required: FILES *.dbf,,WRITE.)
FILES VPI1 VPI VPIN FILES VP-Info Level 1 Reference Manual Page 222 SECTION 4
FILES ... ENDFILES
Lets you specify drive letters, directories, and/or default file modes
for various files used by VP-Info Level 1.
╔════════════════════════════════════════════════════════════════════╗
║ FILES ║
║ <specification> [,[<file direction>] [,<mode>]] ║
║ ENDFILES ║
║ ║
║ specification any file name or "skeleton" (using the * and ? ║
║ wildcards); must not be indented ║
╟────────────────────────────────────────────────────────────────────╢
║ Options: ║
║ ║
║ file direction any legal DOS path, consisting of drive letter ║
║ and colon and/or directory path ║
╟────────────────────────────────────────────────────────────────────╢
║ Option: (VP-Info Professional Network Edition only): ║
║ ║
║ mode any one of the optional file-opening modes used ║
║ in network operation -- LOCK or L, WRITE or W, ║
║ READ or R, or SHARE or S. If no mode is set, ║
║ or if Network Edition is not in use, the ║
║ default mode is LOCK ║
╚════════════════════════════════════════════════════════════════════╝
(Programs and CNF file only) There is always a FILES Table in
memory, set up by the active FILES ... ENDFILES structure. (This
table is empty if there is no active FILES ... ENDFILES structure.)
A FILES ... ENDFILES structure may be created in a program at any
time, and may have any number of specification lines between the FILES
and ENDFILES lines. All existing entries are immediately cleared and
a new FILES Table constructed.
Examples:
*.dbf,c:\data
Causes VP-Info Level 1 to add C:\DATA\ to the front of all file names
Given this command, either in a VP-Info Level 1 program or in
Conversational VP-Info Level 1, VP-Info Level 1 searches the FILES
Table in memory for a matching file specification. If the file
specification *.DBF is found, the new path will replace the existing
path; otherwise, this specification and redirection is added to the
top of the FILES Table.
FILES *.frm
If no <file direction> is specified, file redirection is turned off
for files matching this entry.
FILES ... ENDFILES VPI1 VPI VPIN FILES ... ENDFILES VP-Info Level 1 Reference Manual Page 223 SECTION 4
A FILES ... ENDFILES structure is cleared by an empty structure
as follows:
FILES
ENDFILES
No macros are permitted in the FILES ... ENDFILES structure,
although macros are allowed with the FILES command itself, either in
programs or in Conversational VP-Info Level 1.
Caution: There is no way to add a comment inside a FILES ...
ENDFILES structure, and no line should be indented. The contents
of FILES ... ENDFILES structures are not affected by the
reformatting facility Alt-F of the WRITE command.
For VP-Info Professional Network Edition only
There is a special form of FILES ... ENDFILES entry which has
significance only in VP-Info Professional Network Edition with SET
NETWORK ON.
This form adds a <mode> which sets the default file mode for all
matching files. For example,
*.ndx,ndx,READ
sets a file mode of READ for all files with an NDX extension, all of
which are found in the NDX subdirectory of the current directory.
If only <specification> and <mode> are given, the file mode is
given to all files matching that specification wherever they are on
the disk. (Note: two commas are required: *.dbf,,WRITE.)
FILES ... ENDFILES VPI1 VPI VPIN FILES ... ENDFILES VP-Info Level 1 Reference Manual Page 224 SECTION 4
FILES=
Set the maximum number of files which can be open at one time
(requires DOS 3.3 and above and VP-Info Professional)
╔════════════════════════════════════════════════════════════════════╗
║ FILES= <num const> ║
║ ║
║ VP-Info Professional only VPI.SET file only ║
║ ║
║ <num const> maximum number of files that can be open at any one ║
║ time; range 21 to 65 ║
╚════════════════════════════════════════════════════════════════════╝
VP-Info Professional is not limited to the 20-file maximum of
Level 1 and earlier versions of VP-Info, provided the operating system
allows more than 20 open files (DOS 3.3 and above) and that a FILES=
statement is present in the CONFIG.SYS file specifying at least <n>
files.
As a practical matter, <n> should be in the range 25 to 60; the
default and minimum is 20. Loading more files reduces the maximum size
of programs and reduces speed of such memory-intensive commands as
INDEX.
This command may be placed only in the VPI.SET file, which is
executed by VP-Info Professional only when first loaded. See VPI.SET
in the Required Files chapter.
Example:
1>FILES=50
FILES= VPI VPIN FILES= VP-Info Level 1 Reference Manual Page 225 SECTION 4
FILES LIST
Display the current contents of the FILES ... ENDFILES structure
╔════════════════════════════════════════════════════════════════════╗
║ FILES LIST ║
╚════════════════════════════════════════════════════════════════════╝
The current FILES ... ENDFILES structure may be displayed with
this command. See FILES and FILES ... ENDFILES.
Example:
1>FILES LIST
File Spec Drive and/or Path
*.CPL CPL2\
*.NDX NDX2\
*.DBF DBF\
*.DBK DBK\
FILES LIST VPI1 VPI VPIN FILES LIST